완전탐색

    [LeetCode] 140. Word Break II

    140. Word Break II Hard Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order. Note that the same word in the dictionary may be reused multiple times in the segmentation. Example 1: Input: s = "catsanddog", wordDict = ["cat","cats","and","sand","dog"] Output: ["cat..

    [LeetCode] 131. Palindrome Partitioning

    131. Palindrome Partitioning Medium Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example 1: Input: s = "aab" Output: [["a","a","b"],["aa","b"]] Example 2: Input: s = "a" Output: [["a"]] Constraints: 1 = len(s): self.ans.append(temp.copy()) for i in range(idx, len(s)): if palin(s, idx, i): temp.append(s..

    [LeetCode] 130. Surrounded Regions

    [LeetCode] 130. Surrounded Regions

    130. Surrounded Regions Medium Given an m x n matrix board containing 'X' and 'O', capture all regions that are 4-directionally surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Example 1: Input: board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]] Output: [["X","X","X","X"],["X","X","X","X"],["X","X","X","X"],["X","O",..

    [LeetCode] 531. Lonely Pixel I

    [LeetCode] 531. Lonely Pixel I

    531. Lonely Pixel I Medium Given an m x n picture consisting of black 'B' and white 'W' pixels, return the number of black lonely pixels. A black lonely pixel is a character 'B' that located at a specific position where the same row and same column don't have any other black pixels. Example 1: Input: picture = [["W","W","B"],["W","B","W"],["B","W","W"]] Output: 3 Explanation: All the three 'B's ..

    [알고리즘 문제 해결 전략] Part 1. 6장 무식하게 풀기

    [알고리즘 문제 해결 전략] Part 1. 6장 무식하게 풀기

    알고리즘 문제해결 전략 1 권, 흔히 불리는 이름은 종만북 ! 그럼 이제,,, 시작.. ( 내 글이랑 문제 글 색이랑 같아서 색을 수정 했다... ) 6장 무식하게 풀기, 완전 탐색? 으로 모든 경우의 수를 찾아서 답을 찾아내는 방식 1. 예제 : 보글 게임 (문제 : ID : BOGGLE, 난이도 : 하)https://algospot.com/judge/problem/read/BOGGLE 보글(Boggle) 게임은 그림 (a)와 같은 5x5 크기의 알파벳 격자인 게임판의 한 글자에서 시작해서 펜을 움직이면서 만나는 글자를 그 순서대로 나열하여 만들어지는 영어 단어를 찾아내는 게임입니다. 펜은 상하좌우, 혹은 대각선으로 인접한 칸으로 이동할 수 있으며 글자를 건너뛸 수는 없습니다. 지나간 글자를 다시 지나..