From 841ba304bd486c6b45cc47199adb6e6a777437f3 Mon Sep 17 00:00:00 2001 From: yennanliu Date: Fri, 27 Dec 2024 14:30:33 +0800 Subject: [PATCH] add 079, 212 problem description, progress --- data/progress.md | 3 ++ data/progress.txt | 1 + data/to_review.txt | 14 ++++--- .../LeetCodeJava/BackTrack/WordSearch.java | 39 ++++++++++++++++++- .../LeetCodeJava/BackTrack/WordSearch2.java | 37 ++++++++++++++++++ 5 files changed, 87 insertions(+), 7 deletions(-) diff --git a/data/progress.md b/data/progress.md index cb2b1b23..0c9f809b 100644 --- a/data/progress.md +++ b/data/progress.md @@ -1,5 +1,8 @@ # Progress +# 2024-12-27 +- https://github.com/yennanliu/CS_basics/blob/master/doc/Leetcode_company_frequency-master/Google%206months-%20LeetCode.pdf + # 2024-12-22 - https://github.com/yennanliu/CS_basics/blob/master/doc/Leetcode_company_frequency-master/Google%206months-%20LeetCode.pdf diff --git a/data/progress.txt b/data/progress.txt index 6d3b326b..80ffec69 100644 --- a/data/progress.txt +++ b/data/progress.txt @@ -1,3 +1,4 @@ +20241227: 079,212 20241222: 369,311 20241221: 370 20241220: 815,871,593,1109 diff --git a/data/to_review.txt b/data/to_review.txt index 3b9b150e..37a912c9 100644 --- a/data/to_review.txt +++ b/data/to_review.txt @@ -1,28 +1,32 @@ +2025-02-20 -> ['079,212'] 2025-02-15 -> ['369,311'] 2025-02-14 -> ['370'] 2025-02-13 -> ['815,871,593,1109'] 2025-02-07 -> ['560,523'] 2025-02-01 -> ['304,853,325'] +2025-01-30 -> ['079,212'] 2025-01-26 -> ['370(todo)'] 2025-01-25 -> ['369,311'] 2025-01-24 -> ['370', '34,767'] 2025-01-23 -> ['815,871,593,1109'] 2025-01-20 -> ['722,380'] 2025-01-19 -> ['33,81'] -2025-01-17 -> ['560,523', '253'] +2025-01-17 -> ['079,212', '560,523', '253'] 2025-01-16 -> ['776,31'] 2025-01-15 -> ['004(todo),34(todo),162(todo),275(todo)'] 2025-01-14 -> ['986(todo),1229(todo),1868(todo),80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)'] 2025-01-12 -> ['369,311'] 2025-01-11 -> ['370', '304,853,325', '394'] 2025-01-10 -> ['815,871,593,1109', '833,950'] +2025-01-09 -> ['079,212'] 2025-01-05 -> ['370(todo)'] -2025-01-04 -> ['369,311', '560,523', '53,210,207'] +2025-01-04 -> ['079,212', '369,311', '560,523', '53,210,207'] 2025-01-03 -> ['370', '34,767', '444'] 2025-01-02 -> ['815,871,593,1109', '1188,130,855(again)'] -2024-12-30 -> ['369,311', '722,380'] -2024-12-29 -> ['370', '304,853,325', '33,81'] -2024-12-28 -> ['815,871,593,1109', '900'] +2025-01-01 -> ['079,212'] +2024-12-30 -> ['079,212', '369,311', '722,380'] +2024-12-29 -> ['079,212', '370', '304,853,325', '33,81'] +2024-12-28 -> ['079,212', '815,871,593,1109', '900'] 2024-12-27 -> ['369,311', '560,523', '253', '26,27', '802,1197,26'] 2024-12-26 -> ['370', '776,31'] 2024-12-25 -> ['369,311', '815,871,593,1109', '004(todo),34(todo),162(todo),275(todo)'] diff --git a/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch.java b/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch.java index b2b6c262..6da1a292 100644 --- a/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch.java +++ b/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch.java @@ -1,8 +1,43 @@ package LeetCodeJava.BackTrack; // https://leetcode.com/problems/word-search/ - - +/** + * 79. Word Search + * Solved + * Medium + * Topics + * Companies + * Given an m x n grid of characters board and a string word, return true if word exists in the grid. + * + * The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once. + * + * + * + * Example 1: + * + * + * Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED" + * Output: true + * Example 2: + * + * + * Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE" + * Output: true + * Example 3: + * + * + * Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB" + * Output: false + * + * + * Constraints: + * + * m == board.length + * n = board[i].length + * 1 <= m, n <= 6 + * 1 <= word.length <= 15 + * board and word consists of only lowercase and uppercase English letters. + */ public class WordSearch { // V0 diff --git a/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch2.java b/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch2.java index a74c38d9..987534d3 100644 --- a/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch2.java +++ b/leetcode_java/src/main/java/LeetCodeJava/BackTrack/WordSearch2.java @@ -5,6 +5,43 @@ import java.util.ArrayList; import java.util.List; +/** + * 212. Word Search II + * Solved + * Hard + * Topics + * Companies + * Hint + * Given an m x n board of characters and a list of strings words, return all words on the board. + * + * Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. + * + * + * + * Example 1: + * + * + * Input: board = [["o","a","a","n"],["e","t","a","e"],["i","h","k","r"],["i","f","l","v"]], words = ["oath","pea","eat","rain"] + * Output: ["eat","oath"] + * Example 2: + * + * + * Input: board = [["a","b"],["c","d"]], words = ["abcb"] + * Output: [] + * + * + * Constraints: + * + * m == board.length + * n == board[i].length + * 1 <= m, n <= 12 + * board[i][j] is a lowercase English letter. + * 1 <= words.length <= 3 * 104 + * 1 <= words[i].length <= 10 + * words[i] consists of lowercase English letters. + * All the strings of words are unique. + * + */ public class WordSearch2 { // V0