Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).
PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].
ZigZag ConversionThe 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 font for better legibility)P A H NA P L S I I GY I R
Happy NumberWrite an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will…
LeetCode — — House Robber & House Robber II题目链接You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system…
Length of Last WordGiven 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 word does not exist, return 0.
Implement strStr()mplement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.运行时间太长了,很没效率的算法,考虑如何优化中。。。
Leetcode 238 Product of Array Except SelfQuestion:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal tothe product of all the elements of nums except nums[i].Solve it without division and in O(n).For example, given [1,2,3,4], return [24,12,8,6].