[LeetCode] 696. 计数二进制子串

题目描述:给定一个字符串 s,计算具有相同数量0和1的非空(连续)子字符串的数量,并且这些子字符串中的所有0和所有1都是组合在一起的。重复出现的子串要计算它们出现的次数。示例 1 :输入: "00110011" 输出: 6 解释: 有6个子串具有相同数量的连续1...

2018-04-13 14:07:25

阅读数 201

评论数 0

[LeetCode] 811. 子域名访问计数

题目描述:一个网站域名,如"discuss.leetcode.com",包含了多个子域名。作为顶级域名,常用的有"com",下一级则有"leetcode.com",最低的一级为&qu...

2018-04-12 19:36:37

阅读数 901

评论数 0

[LeetCode] 463. Island Perimeter

Description:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected ho...

2018-04-11 23:02:10

阅读数 26

评论数 0

[剑指offer] 矩阵中的路径

Description: 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。如果一条路径经过了矩阵中的某一个格子,则该路径不能再进入该格子。 例如 :   a      b   ...

2018-04-07 22:12:42

阅读数 32

评论数 0

[剑指offer] 合并两个有序

Description:输入两个单调递增的链表,输出两个链表合成后的链表,需要合成后的链表满足单调不减规则Solution:/* public class ListNode { int val; ListNode next = null; ListNode(int val...

2018-04-07 15:13:04

阅读数 30

评论数 0

[剑指offer] 重建二叉树

Description:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。Solution:/** * Def...

2018-03-31 16:53:11

阅读数 31

评论数 0

[LeetCode] 5. Longest Palindromic Substring

Description:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: &qu...

2018-03-24 23:48:25

阅读数 25

评论数 0

构造回文--最长回文子序列

Description:时间限制:1秒空间限制:32768K给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长呢?输出需要删除的字符个数。输入描述:输入数据有多组,每组包含一个字符串s,且保证:1<=s.length&amp...

2018-03-24 23:02:27

阅读数 27

评论数 0

[LeetCode] 747. Min Cost Climbing Stairs

Problem: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb...

2018-01-03 21:03:40

阅读数 80

评论数 0

[LeetCode] 394. Decode String

Problem: Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square...

2018-01-02 12:31:57

阅读数 63

评论数 0

[证明] NP-完全问题

算法概论(注释版)第八章 Exercise 8.3 题目描述: STINGY SAT is the following problem: given a set of clauses(each a disjunction of literals) and an integer k, find ...

2018-01-01 11:09:28

阅读数 75

评论数 0

[LeetCode] 728. Self Dividing Numbers

Problem: A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because ...

2017-12-26 11:27:32

阅读数 70

评论数 0

[LeetCode] 136. Single Number

Problem: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a li...

2017-12-25 22:46:03

阅读数 42

评论数 0

[LeetCode] 557. Reverse Words in a String III

Problem: Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initia...

2017-12-25 22:04:53

阅读数 40

评论数 0

[LeetCode] 199. Binary Tree Right Side View

Problem: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bot...

2017-12-23 13:40:19

阅读数 50

评论数 0

[LeetCode] 494. Target Sum

Problem: You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you sh...

2017-12-21 20:36:16

阅读数 60

评论数 0

[LeetCode] 416. Partition Equal Subset Sum

Problem: Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elem...

2017-12-21 19:28:48

阅读数 53

评论数 0

[LeetCode] 337. House Robber III

Problem: The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besi...

2017-12-17 21:55:41

阅读数 62

评论数 0

[LeetCode] Convert Sorted Array to Binary Search Tree

Problem: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balance...

2017-12-16 13:13:54

阅读数 66

评论数 0

[LeetCode] 100. Same Tree

Problem: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are ...

2017-12-16 11:45:29

阅读数 58

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭