3.14shopee虾皮java笔试情况


#shopee笔试##Shopee#
全部评论
你们什么时候投的简历啊,昨天的笔试场
点赞 回复 分享
发布于 2022-03-15 13:42
大佬看一下第三题dp这样写行不行,考试的时候少写一个-1,人给卡傻了 public static int findMaximizedCapital(int k, int w, int[] profits, int[] capital) {         // write code here         int projectNum = k;         int money = w;         //dp[i][j]表示在第i轮里投资第j个项目的最大收益         int[][] dp = new int[projectNum+1][capital.length];         //第一轮投资的最大收益         for (int i = 0; i < dp[0].length; i++) {             if(money>=capital[i]){                 dp[1][i] = money+profits[i];             }         }         for (int i = 2; i < dp.length; i++) {             for (int j = 1; j < dp[0].length; j++) {                 money = dp[i-1][j-1];//这里考试的时候没-1,卡傻了,第三题0分                 dp[i][j]=dp[i-1][j-1];                 if(money>=capital[j]){                     dp[i][j]=Math.max(dp[i][j],money+profits[j]);                 }             }         }         return dp[dp.length-1][dp[0].length-1];     }
点赞 回复 分享
发布于 2022-03-14 21:28

相关推荐

抱抱碍事梨a:三点建议,第一点是建议再做一个项目,把自我介绍部分顶了,第二点是中南大学加黑加粗,第三点是建议加v详细交流
点赞 评论 收藏
分享
真烦好烦真烦:牛友太有实力了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务