My Software Engineering

My Software Engineering

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

My Software Engineering

컨텐츠 검색

태그

최근글

댓글

공지사항

아카이브

Leetcode(93)

  • 56. Merge Intervals

    Desription: Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. ''' [1] solution) idea:: find overlapping intervals and edit intervals code:: non_overlapping=[] # answer intervals.sort(key=lambda x:x[0]) # sort tmp=intervals[0] for inter in intervals: if i..

    2021.10.21
  • 380. Insert Delete GetRandom O(1)

    Description: Implement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise. bool remove(int val) Removes an item val from the set if present. Returns true if the item was present, false otherwise. int getRandom() Returns a random element from ..

    2021.10.21
  • 45. Jump Game II

    Description: Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps. You can assume that you can always reach the last index. ''' [1] brute force) idea:: consider all cases return min steps ''' '''..

    2021.10.20
  • 11. Container With Most Water

    Description: Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water. Notice that you may not slant the container. ''' [1] brute force - Time L..

    2021.10.20
  • 55. Jump Game

    Description: You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Return true if you can reach the last index, or false otherwise. ''' [1] brute force(back tracking) - Time Limit Exceeded) idea:: check all cases code:: def jump(cur,dest): if cur>=dest: return True elif num..

    2021.10.20
  • 151. Reverse Words in a String

    Description: Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return a string of the words in reverse order concatenated by a single space. Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single sp..

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

티스토리툴바