随笔分类 - Leetcode
摘要:169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y
阅读全文
摘要:717. 1-bit and 2-bit Characters We have two special characters. The first character can be represented by one bit 0. The second character can be repre
阅读全文
摘要:697. Degree of an Array Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one
阅读全文
摘要:606. Construct String from Binary Tree You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traver
阅读全文
摘要:104. Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from th
阅读全文
摘要:669. Trim a Binary Search Tree Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lie
阅读全文
摘要:122. Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to
阅读全文
摘要:617. Merge Two Binary Trees 递归!递归!
阅读全文
摘要:283. Move Zeroes 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 elements.
阅读全文
摘要:448. Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others
阅读全文
摘要:234. Palindrome Linked List Given a singly linked list, determine if it is a palindrome.
阅读全文
摘要:160. Intersection of Two Linked Lists Write a program to find the node at which the intersection of two singly linked lists begins. For example, the f
阅读全文
摘要:203. Remove Linked List Elements Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5
阅读全文
摘要:141. Linked List Cycle Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 快慢指针
阅读全文
摘要:21. Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of th
阅读全文
摘要:83. Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1-
阅读全文
摘要:206. Reverse Linked List Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both
阅读全文
摘要:237. Delete Node in a Linked List 思路:用node节点的下一个节点来覆盖node节点,然后删除node的下一个节点
阅读全文
摘要:Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on
阅读全文

浙公网安备 33010602011771号