share my java solution!

  • 0
    public class Solution {
        public int maxVacationDays(int[][] flights, int[][] days) {
            int N=days.length;
            int K=days[0].length;
            int[][] dp=new int[N][K];
            int res=0;
            dfs(flights, days, dp, 0, 0);
            // for(int i=0;i<dp.length;i++){
            //     res=Math.max(res,dp[i][0]);
            // }
            return dp[0][0];
        public int dfs(int[][] flights, int[][] days,int[][] dp, int week,int cur_city){
                return 0;
            }else if(dp[cur_city][week]!=0){
                return dp[cur_city][week];
                int res=0;
                for(int j=0;j<flights.length;j++){
                    if(cur_city==j || flights[cur_city][j]==1){
                return dp[cur_city][week];

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.