随笔分类 -  LeetCode

摘要:Count and Say (E) 题目 The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 阅读全文
posted @ 2020-06-27 02:16 墨云黑 阅读(80) 评论(0) 推荐(0)
摘要:Rectangle Area (M) 题目 Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and 阅读全文
posted @ 2020-06-26 07:05 墨云黑 阅读(138) 评论(0) 推荐(0)
摘要:Game of Life (M) 题目 According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British 阅读全文
posted @ 2020-06-26 06:14 墨云黑 阅读(229) 评论(0) 推荐(0)
摘要:Sudoku Solver (H) 题目 Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: E 阅读全文
posted @ 2020-06-26 03:48 墨云黑 阅读(203) 评论(0) 推荐(0)
摘要:Valid Sudoku (M) 题目 Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row mu 阅读全文
posted @ 2020-06-26 02:33 墨云黑 阅读(128) 评论(0) 推荐(0)
摘要:Search Insert Position (E) 题目 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it woul 阅读全文
posted @ 2020-06-26 01:56 墨云黑 阅读(71) 评论(0) 推荐(0)
摘要:Find First and Last Position of Element in Sorted Array (M) 题目 Given an array of integers nums sorted in ascending order, find the starting and ending 阅读全文
posted @ 2020-06-26 01:49 墨云黑 阅读(62) 评论(0) 推荐(0)
摘要:Find the Duplicate Number (M) 题目 Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least 阅读全文
posted @ 2020-06-25 08:31 墨云黑 阅读(131) 评论(0) 推荐(0)
摘要:题目 Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compute the re 阅读全文
posted @ 2020-06-25 06:12 墨云黑 阅读(144) 评论(0) 推荐(0)
摘要:Search in Rotated Sorted Array (M) 题目 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5 阅读全文
posted @ 2020-06-25 05:42 墨云黑 阅读(160) 评论(0) 推荐(0)
摘要:Longest Valid Parentheses (H) 题目 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parenth 阅读全文
posted @ 2020-06-25 04:03 墨云黑 阅读(113) 评论(0) 推荐(0)
摘要:Next Permutation (M) 题目 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such a 阅读全文
posted @ 2020-06-25 01:38 墨云黑 阅读(112) 评论(0) 推荐(0)
摘要:Substring with Concatenation of All Words (H) 题目 You are given a string, s, and a list of words, words, that are all of the same length. Find all star 阅读全文
posted @ 2020-06-24 11:18 墨云黑 阅读(156) 评论(0) 推荐(0)
摘要:Divide Two Integers (M) 题目 Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Retur 阅读全文
posted @ 2020-06-24 04:27 墨云黑 阅读(114) 评论(0) 推荐(0)
摘要:Implement strStr() (E) 题目 Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 阅读全文
posted @ 2020-06-24 02:43 墨云黑 阅读(105) 评论(0) 推荐(0)
摘要:Remove Element (E) 题目 Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extr 阅读全文
posted @ 2020-06-24 02:00 墨云黑 阅读(113) 评论(0) 推荐(0)
摘要:Remove Duplicates from Sorted Array (E) 题目 Given a sorted array nums, remove the duplicates in-place such that each element appear only once and retur 阅读全文
posted @ 2020-06-24 01:38 墨云黑 阅读(97) 评论(0) 推荐(0)
摘要:Nim Game (E) 题目 You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to re 阅读全文
posted @ 2020-06-23 07:31 墨云黑 阅读(108) 评论(0) 推荐(0)
摘要:Word Pattern (E) 题目 Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijec 阅读全文
posted @ 2020-06-23 04:32 墨云黑 阅读(122) 评论(0) 推荐(0)
摘要:Peeking Iterator (M) 题目 Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the 阅读全文
posted @ 2020-06-23 03:17 墨云黑 阅读(132) 评论(0) 推荐(0)