My Software Engineering

My Software Engineering

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

My Software Engineering

컨텐츠 검색

태그

최근글

댓글

공지사항

아카이브

Leetcode(93)

  • 931. Minimum Falling Path Sum

    Description: Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix. A falling path starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position (row, col) will be (row + 1, col - 1), (row + 1, col), or (row + 1, col + 1). """ [1] Brut..

    2021.10.16
  • 3. Longest Substring Without Repeating Characters

    Description: Given a string s, find the length of the longest substring without repeating characters. class Solution: def lengthOfLongestSubstring(self, s: str) -> int: slow=0 fast=0 long=0 map={} while fast1: long=max(long,fast-slow) while map[s[fast]]>1: map[s[slow]]-=1 slow+=1 fast+=1 long=max(long,fast-slow) return long # when n==len(str) # T/C: O(n) # S/C: O(n)

    2021.10.15
  • 1008. Construct Binary Search Tree from Preorder Traversal

    Description: Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root. It is guaranteed that there is always possible to find a binary search tree with the given requirements for the given test cases. A binary search tree is a binary tree where for every node, any descendant of Node.left has a value s..

    2021.10.15
1 ··· 13 14 15 16
티스토리
© 2018 TISTORY. All rights reserved.

티스토리툴바