随笔分类 - LeetCode
摘要:Move Zeros 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. For e
阅读全文
摘要:Ugly Number Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3
阅读全文
摘要:Single Number III Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find
阅读全文
摘要:Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the proce
阅读全文
摘要:Delete Node in a Linked List Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the
阅读全文
摘要:Invert Binary Tree Invert a binary tree. to
阅读全文
摘要:Remove Linked List Elements Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 -->
阅读全文
摘要:Happy Number Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any po
阅读全文
摘要:Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear r
阅读全文
摘要: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 find
阅读全文
摘要:Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to
阅读全文
摘要: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 the roo
阅读全文
摘要:Same Tree Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally i
阅读全文
摘要:Remove Element Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for anot
阅读全文
摘要:Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321
阅读全文
摘要:String to Integer (atoi) Implement atoi to convert a string to an integer.
阅读全文

浙公网安备 33010602011771号