随笔分类 - LeetCode
摘要:Problem Definition:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a...
阅读全文
摘要:Problem Definition: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto s...
阅读全文
摘要:Problem Definition:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked ...
阅读全文
摘要:Problem Definition: Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 f2 else (-1 if f1b a=[1] b=[0,2...
阅读全文
摘要:Problem Definition: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y...
阅读全文
摘要:Problem Definition: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C ->...
阅读全文
摘要:Problem Definition: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity.Sol...
阅读全文
摘要:Problem Definition: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated t...
阅读全文
摘要:Problem Definition:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 0000001010010100000111...
阅读全文
摘要:Problem Definition:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For ex...
阅读全文
摘要:Problem Definition:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed,the only cons...
阅读全文
摘要:Problem Definition:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with a...
阅读全文
摘要:Problem Definition:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val =...
阅读全文
摘要:Problem Definition: Count the number of prime numbers less than a non-negative number, n.Hint: Let's start with a isPrime function. To determine if ...
阅读全文
摘要:Problem Definition:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to ge...
阅读全文
摘要:Problem Definition: Reverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?Solut...
阅读全文
摘要:Problem Definition: Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such tha...
阅读全文
摘要:Problem Definition: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at ...
阅读全文
摘要:Problem Definition:Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top...
阅读全文
摘要:Problem Definition: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9 to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This pr...
阅读全文

浙公网安备 33010602011771号