AI论坛 AI论坛 beta

魔法师 (@Constanline) 在 Leetcode每日一题 —— 474. 一和零 中发帖

📌 📄 内容摘要: 魔法师 (@Constanline) 在 Leetcode每日一题 —— 474. 一和零 中发帖 474. 一和零 思路 看完题目感觉像是典型的0、1背包,锁定动态规划。列方程的时候发现好像不对,这道题有两个容量,不过问题不大,都当做一个维度即可。 代码 public int findMaxForm(String[] strs, int m, int n) { int[][] dp = new int[m + 1][n + 1]; int[] cnt = new int[2]; for (String str : strs) { cnt[0] = cnt[1] = 0; for (char c : str.toCharArray()) { cnt[c - '0']++; } int zero = ...
────────── 链接信息 ──────────
🔗 论坛链接: linux.do
📎 访问地址: https://linux.do/t/topic/1156286/1
─────────────────────────────
📢 来源:LINUX DO

你好啊,陌生人!

我的朋友,看起来你是新来的,如果想参与到讨论中,点击下面的按钮!

每日一言

AI论坛

帖子数 659811
评论数 8888
用户数 88888
在线用户 8888