目前分類:LeetCode (40)

瀏覽方式: 標題列表 簡短摘要

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

4. Median of Two Sorted Arrays

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

215. Kth Largest Element in an Array

Given an integer array nums and an integer k, return the kth largest element in the array.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

75. Sort Colors

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

179. Largest Number

Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

27. Remove Element

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

56. Merge Intervals

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.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

735. Asteroid Collision

We are given an array asteroids of integers representing asteroids in a row.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

1249. Minimum Remove to Make Valid Parentheses

Given a string s of '(' , ')' and lowercase English characters.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

1209. Remove All Adjacent Duplicates in String II

You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

1472. Design Browser History

You have a browser of one tab where you start on the homepage and you can visit another url, get back in the history number of steps or move forward in the history number of steps.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

20. Valid Parentheses

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

227. Basic Calculator II

Given a string s which represents an expression, evaluate this expression and return its value

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

150. Evaluate Reverse Polish Notation

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

232. Implement Queue using Stacks

Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty).

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

54. Spiral Matrix

Given an m x n matrix, return all elements of the matrix in spiral order.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

543. Diameter of Binary Tree

Given the root of a binary tree, return the length of the diameter of the tree.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

104. Maximum Depth of Binary Tree

Given the root of a binary tree, return its maximum depth.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

122. Best Time to Buy and Sell Stock II

You are given an integer array prices where prices[i] is the price of a given stock on the ith day.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

1 2