PikachuBLOG


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

39. Combination Sum

发表于 2017-07-19 | 分类于 LeetCode | 阅读次数
字数统计 799 | 阅读时长 4

39. Combination Sum

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.

Note:
  All numbers (including target) will be positive integers.
  The solution set must not contain duplicate combinations.

For example, given candidate set [2, 3, 6, 7] and target 7,
A solution set is:
[
 [7],
 [2, 2, 3]
]

阅读全文 »

38. Count and Say

发表于 2017-07-19 | 分类于 LeetCode | 阅读次数
字数统计 540 | 阅读时长 3

38. Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, …

1 is read off as “one 1” or 11.
11 is read off as “two 1s” or 21.
21 is read off as “one 2, then one 1” or 1211.

Given an integer n, generate the nth sequence.
Note: The sequence of integers will be represented as a string.

阅读全文 »

37. Sudoku Solver

发表于 2017-07-18 | 分类于 LeetCode | 阅读次数
字数统计 817 | 阅读时长 4

37. Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character ‘.’.
You may assume that there will be only one unique solution.
37-1-Sudoku
A sudoku puzzle…
37-2-Sudoku
…and its solution numbers marked in red.

阅读全文 »

36. Valid Sudoku

发表于 2017-07-18 | 分类于 LeetCode | 阅读次数
字数统计 971 | 阅读时长 5

36. Valid Sudoku

Determine if a Sudoku is valid, according to : Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.

36-Sudoku`
A partially filled sudoku which is valid.

Note :
  A valid Sudoku board(partially filled) is not necessarily solvable.Only the filled cells need to be validated.

阅读全文 »

35. Search Insert Position

发表于 2017-07-18 | 分类于 LeetCode | 阅读次数
字数统计 399 | 阅读时长 2

35. Search Insert Position

Given a sorted array and a target value, return the index if the target is found.If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.

Here are few examples.
 [1, 3, 5, 6], 5 → 2
 [1, 3, 5, 6], 2 → 1
 [1, 3, 5, 6], 7 → 4
 [1, 3, 5, 6], 0 → 0

阅读全文 »

34. Search for a Range

发表于 2017-07-18 | 分类于 LeetCode | 阅读次数
字数统计 777 | 阅读时长 4

34. Search for a Range

Given an array of integers sorted in ascending order, 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).
If the target is not found in the array, return [-1, -1].

For example,
Given [5, 7, 7, 8, 8, 10] and target value 8,
return [3, 4].

阅读全文 »

33. Search in Rotated Sorted Array

发表于 2017-07-18 | 分类于 LeetCode | 阅读次数
字数统计 566 | 阅读时长 3

33. Search in Rotated Sorted Array

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 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.

阅读全文 »

31. Next Permutation

发表于 2017-07-17 | 分类于 LeetCode | 阅读次数
字数统计 932 | 阅读时长 5

31. Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replacement must be in-place, do not allocate extra memory.

Here are some examples. Inputs are in the left-hand column and its corresponding outputs are in the right-hand column.
1,2,3 → 1,3,2
3,2,1 → 1,2,3
1,1,5 → 1,5,1

阅读全文 »

30. Substring with Concatenation of All Words

发表于 2017-07-17 | 分类于 LeetCode | 阅读次数
字数统计 540 | 阅读时长 3

30. Substring with Concatenation of All Words

You are given a string, s, and a list of words, words, that are all of the same length.Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.

For example, given:
s: “barfoothefoobarman”
words : [“foo”, “bar”]
You should return the indices : [0, 9].
(order does not matter).

阅读全文 »

28. Implement strStr()

发表于 2017-07-12 | 分类于 LeetCode | 阅读次数
字数统计 726 | 阅读时长 4

28. Implement strStr()

Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

题意:

  返回在haystack中第一次出现的needle的索引,如果不存在就返回-1。

阅读全文 »
1…131415…17
CodePikachu

CodePikachu

技术随笔

168 日志
5 分类
7 标签
RSS
GitHub Twitter 微博 知乎
0%
© 2015 - 2020 CodePikachu
博客全站共123.3k字
本站访客数:
由 Hexo 强力驱动
主题 - NexT.Pisces