LeetCode 37

[LeetCode 75] Medium - 1071. Greatest Common Divisor of Strings ☆

1071. Greatest Common Divisor of Strings For two strings s and t, we say "t divides s" if and only if s = t + t + t + ... + t + t (i.e., t is concatenated with itself one or more times).Given two strings str1 and str2, return the largest string x such that x divides both str1 and str2. Example 1:Input: str1 = "ABCABC", str2 = "ABC"Output: "ABC"Example 2:Input: str1 = "ABABAB", str2 = "ABAB"Outpu..

LeetCode/LeetCode75 2024.11.11

[LeetCode 75] Medium - 452. Minimum Number of Arrows to Burst Balloons

452. Minimum Number of Arrows to Burst Balloons There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter stretches between xstart and xend. You do not know the exact y-coordinates of the balloons.Arrows can be shot up directly vertic..

LeetCode/공통 2024.11.10

[LeetCode] Leetcode 75 Questions (NeetCode on yt)

Leetcode 75 질문 유형 및 유투브 솔루션 링크 정리 https://docs.google.com/spreadsheets/d/1BiY_cRfXI9yJPaU75RFcfVRN2OF1CilpiwX5cdHXRoU/edit?usp=sharing  김현구: Leetcode 75 Questions (NeetCode on yt)trick: I though use trie to store the grid, reverse thinking, instead store dictionary words, dfs on each cell, check if cell's char exists as child of root node in trie, if it does, update currNode, and check neighbors..

[Trees: Trie] 208. Implement Trie (Prefix Tree)

208. Implement Trie (Prefix Tree) https://youtu.be/oobqoCJlHA0?si=rB7vqpOg4d0DiFd1 https://youtu.be/j7Zkw5XWe_Q?si=-yC7nuoxBULmLBuD 이 문제는 Trie(트라이) 자료 구조를 구현하는 것입니다. Trie는 문자열을 효율적으로 저장하고 검색하기 위해 사용되는 트리 형태의 자료 구조입니다. 이 자료 구조는 주로 자동완성, 단어 검색, 접두사 검색과 같은 작업에서 사용됩니다.  Code  # TrieNode 클래스: Trie의 각 노드를 정의class TrieNode: def __init__(self): self.children = {} # 자식 노드를 저장할 해시맵. 키는 문자, 값은 T..

LeetCode/NeetCode 2024.11.09

[LeetCode 75] Medium - 1318. Minimum Flips to Make a OR b Equal to c

1318. Minimum Flips to Make a OR b Equal to c  Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation).Flip operation consists of change any single bit 1 to 0 or change the bit 0 to 1 in their binary representation. Example 1:Input: a = 2, b = 6, c = 5Output: 3Explanation: After flips a = 1 , b = 4 , c = 5 su..

LeetCode/LeetCode75 2024.11.09