随笔分类 -  LeetCode

摘要:Move Zeroes (E) 题目 Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero element 阅读全文
posted @ 2020-06-22 05:39 墨云黑 阅读(90) 评论(0) 推荐(0)
摘要:Reverse Nodes in k-Group (H) 题目 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive inte 阅读全文
posted @ 2020-06-22 03:45 墨云黑 阅读(132) 评论(0) 推荐(0)
摘要:Swap Nodes in Pairs (M) 题目 Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, 阅读全文
posted @ 2020-06-22 02:56 墨云黑 阅读(133) 评论(0) 推荐(0)
摘要:Merge k Sorted Lists (H) 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4- 阅读全文
posted @ 2020-06-22 02:23 墨云黑 阅读(85) 评论(0) 推荐(0)
摘要:Generate Parentheses (M) 题目 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given 阅读全文
posted @ 2020-06-22 01:20 墨云黑 阅读(74) 评论(0) 推荐(0)
摘要:Perfect Squares (M) 题目 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Exa 阅读全文
posted @ 2020-06-21 07:42 墨云黑 阅读(103) 评论(0) 推荐(0)
摘要:Merge Two Sorted Lists (E) 题目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of 阅读全文
posted @ 2020-06-21 06:07 墨云黑 阅读(166) 评论(0) 推荐(0)
摘要:Valid Parentheses (E) 题目 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An inp 阅读全文
posted @ 2020-06-21 05:52 墨云黑 阅读(134) 评论(0) 推荐(0)
摘要:Remove Nth Node From End of List (M) 题目 Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list 阅读全文
posted @ 2020-06-21 05:27 墨云黑 阅读(137) 评论(0) 推荐(0)
摘要:4Sum (M) 题目 Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b+ c + d = target? Find a 阅读全文
posted @ 2020-06-21 03:31 墨云黑 阅读(118) 评论(0) 推荐(0)
摘要:First Bad Version (E) 题目 You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your pr 阅读全文
posted @ 2020-06-20 06:00 墨云黑 阅读(76) 评论(0) 推荐(0)
摘要:Integer to English Words (H) 题目 Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. 阅读全文
posted @ 2020-06-20 05:49 墨云黑 阅读(98) 评论(0) 推荐(0)
摘要:Letter Combinations of a Phone Number (M) 题目 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the num 阅读全文
posted @ 2020-06-20 04:42 墨云黑 阅读(130) 评论(0) 推荐(0)
摘要:3Sum Closest (M) 题目 Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Retur 阅读全文
posted @ 2020-06-20 03:17 墨云黑 阅读(115) 评论(0) 推荐(0)
摘要:3Sum (M) 题目 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which 阅读全文
posted @ 2020-06-20 02:44 墨云黑 阅读(163) 评论(0) 推荐(0)
摘要:Different Ways to Add Parentheses (M) 题目 Given a string of numbers and operators, return all possible results from computing all the different possibl 阅读全文
posted @ 2020-06-19 11:35 墨云黑 阅读(259) 评论(0) 推荐(0)
摘要:Longest Common Prefix (E) 题目 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, retu 阅读全文
posted @ 2020-06-19 08:07 墨云黑 阅读(163) 评论(0) 推荐(0)
摘要:Roman to Integer (E) 题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 阅读全文
posted @ 2020-06-19 07:49 墨云黑 阅读(114) 评论(0) 推荐(0)
摘要:Container With Most Water (M) 题目 Given n non-negative integers \(a_1, a_2, ..., a_n\) , where each represents a point at coordinate \((i, a_i)\). n ve 阅读全文
posted @ 2020-06-19 07:21 墨云黑 阅读(93) 评论(0) 推荐(0)
摘要:Regular Expression Matching (H) Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' M 阅读全文
posted @ 2020-06-19 06:54 墨云黑 阅读(108) 评论(0) 推荐(0)