随笔分类 - leetcode
摘要:初始版本 题目描述 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1
阅读全文
摘要:题目描述 Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100),
阅读全文
摘要:题目概述 Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj =
阅读全文
摘要:题目描述 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [
阅读全文
摘要:#题目简述Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function ...
阅读全文
摘要:#题目简述:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occur...
阅读全文
摘要:#题目简述Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive in...
阅读全文
摘要:#题目简述:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are fille...
阅读全文
摘要:#题目简述:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".#解题思路: class Solution: # @pa...
阅读全文
摘要:#题目简述Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3...
阅读全文
摘要:#题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or ...
阅读全文
摘要:#题目简述Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last ...
阅读全文
摘要:#题目简述The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed ...
阅读全文
摘要:#题目简述You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stoppi...
阅读全文
摘要:#题目简述:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the near...
阅读全文
摘要:#题目简述:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given ...
阅读全文
摘要:#题目简述:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm t...
阅读全文
摘要:#题目简述:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. ...
阅读全文
摘要:#题目简述:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal...
阅读全文
摘要:#题目简述:Write a function to find the longest common prefix string amongst an array of strings.#解题思路: class Solution: # @return a string ...
阅读全文

浙公网安备 33010602011771号