11.1 (DFS, BFS)130. Surrounded Regions (DFS)class Solution { static int[] dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1}; int n, m; public void solve(char[][] board) { // flood fill algorithm. (dfs / bfs) i…
LeetCode Daily Questions Solution. Contribute to Yashmenaria1/Leetcode_daily_solutions development by creating an account on GitHub.
Leetcode Daily Challenge (Nov.) 11.1 (DFS, BFS)classSolution{staticint[]dx={1,0,-1,0},dy={0,1,0,-1};intn,… 阅读全文 leetcode 31~40(更新ing) classSolution{public:voidnextPermutation(vector<int>&nums){intidx=n… 阅读全文 ...
For a year now, I have been trying to make it a habit to solve the Daily LeetCoding Challenge (which I’m still struggling with). As I am usingTodoistas my main productivity tool of choice, I have a daily task that looks just like this: My Todoist habitual tasks As a lazy person,...
NandiSoham / Leetcode-POTD-Daily-Coding-Challenge Star 0 Code Issues Pull requests C++ code of LeetCode Daily Problems ( POTD ) algorithms leetcode leetcode-solutions dsa leetcode-cpp daily-coding-problem potd-solution daily-leetcode potd-leetcode Updated Mar 2, 2025 C++ Improve thi...
Solution class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def reverseList(head): prev = None curr = head while curr: next_node = curr.next # Store the next node curr.next = prev # Reverse the link prev = curr # Move prev to current cur...
DailyChallenge 350. 两个数组的交集 II Easy20200713 题目描述 给定两个数组,编写一个函数来计算它们的交集。 示例1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2,2] 示例2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 输出: [4,9] 说明: 输出结果中每个元素出现的次数...
Solution1 排序+双指针,注意去重 先对数组排序 固定一个数nums[i],在用左右指针L和R在nums[i]的后面分别查找 若nums[i] > 0,则三个数的和一定大于0,直接break 若nums[i] == nums[i-1],说明数字重复,跳过 计算三个数的和sum = nums[i] + nums[L] + nums[R] 若sum == 0,符合要求,写入结果...
Yashmenaria1 / Leetcode_daily_solutions Star 2 Code Issues Pull requests LeetCode Daily Questions Solution leetcode-solutions leetcode-questions leetcode-cpp leetcode-solution leetcode-daily-challenge leetcode-solutions-cpp leetcode-streak daily-leetcode leetcode-daily-solutions Updated Sep 17,...
DSA Crack Sheet Added new solution under Binary Tree Aug 8, 2022 Leetcode Daily Challenge Update README.md Oct 19, 2021 Leetcode Study Plan data str 1 Jan 23, 2022 Leetcode Top Interview Questions Merge branch 'master' into Summary-Ranges Oct 27, 2021 Resources Update GitCheatsheet.md Oct...