My Software Engineering

My Software Engineering

  • 분류 전체보기 (94)
    • Leetcode (93)
  • 홈
  • Leetcode
RSS 피드
로그인
로그아웃 글쓰기 관리

My Software Engineering

컨텐츠 검색

태그

최근글

댓글

공지사항

아카이브

Leetcode(93)

  • 424. Longest Repeating Character Replacement

    Description: You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times. Return the length of the longest substring containing the same letter you can get after performing the above operations. ''' [1] sliding window) idea:: len(cur_window)-(the number of character wi..

    2021.11.06
  • 76. Minimum Window Substring

    Description: Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "". The testcases will be generated such that the answer is unique. A substring is a contiguous sequence of characters within the string. ''' [1] bru..

    2021.11.05
  • 441. Arranging Coins

    Description: You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete. Given the integer n, return the number of complete rows of the staircase you will build. ''' [1] brute force) idea:: fill stairs with coins from top. code:: def arrangeCoins(self, n: int) -> int:..

    2021.11.05
  • 130. Surrounded Regions

    Description: 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. ''' [1] dfs) idea:: while moving on the border, if meet 'O', then make all connected 'O' as '#'. after then, remaining 'O' should be flipped (surrounded, so it is not connected border-'O') a..

    2021.11.04
  • 42. Trapping Rain Water

    Description: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. ''' [1] brute force) idea:: 1.calculate the amount of water on the each box. 2. to calculate, need to check max height of box on the left-side and the right-side. 3. water on the box at array[i] = min(max_left, max_right) - height[i] 4-1. if..

    2021.11.03
  • 129. Sum Root to Leaf Numbers

    Description: You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123. Return the total sum of all root-to-leaf numbers. Test cases are generated so that the answer will fit in a 32-bit integer. A leaf node is a node with no children. # Definition fo..

    2021.11.03
1 ··· 4 5 6 7 8 9 10 ··· 16
티스토리
© 2018 TISTORY. All rights reserved.

티스토리툴바