leetcode 3. Longest Substring Without Repeating Characters
摘要:Given a string, find the length of the longest substring without repeating characters. 思路:用map维护区间内各个字母的数量,然后遇到已经访问过的就进行滑动区间,来得到符合条件的区间,然后求最大区间长度。 虽然时
阅读全文
posted @
2018-03-17 10:21
Beserious
阅读(121)
推荐(0) 编辑
leetcode 84. Largest Rectangle in Histogram
摘要:Given n non negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist
阅读全文
posted @
2018-03-13 22:36
Beserious
阅读(143)
推荐(0) 编辑
给出先序遍历和中序遍历还原树(二叉链表)
摘要:转载注明出处:http://www.cnblogs.com/pk28/ 补充树的3中遍历方式: 看下图: 先序遍历序列(4,1,3,2,6,5,7) 中序遍历序列(1,2,3,4,5,6,7) 后序遍历序列(2,3,1,5,7,6,4) 观察遍历的方式,我们可以知道,一棵树的先序遍历的第一个元素是树
阅读全文
posted @
2017-11-26 17:30
Beserious
阅读(1793)
推荐(1) 编辑
leetcode 694. Number of Distinct Islands
摘要:Given a non empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4 directionally (horizontal or vertical.) Yo
阅读全文
posted @
2017-10-08 11:21
Beserious
阅读(851)
推荐(0) 编辑
leetcode 15. 3Sum
摘要:每日一道题目,预防思维僵化 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which giv
阅读全文
posted @
2017-09-04 15:04
Beserious
阅读(159)
推荐(0) 编辑
leetcode 523. Continuous Subarray Sum
摘要:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that
阅读全文
posted @
2017-08-30 17:48
Beserious
阅读(328)
推荐(1) 编辑
leetcode 667. Beautiful Arrangement II
摘要:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ
阅读全文
posted @
2017-08-29 16:12
Beserious
阅读(224)
推荐(0) 编辑
leetcode 659. Split Array into Consecutive Subsequences
摘要:You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subseq
阅读全文
posted @
2017-08-17 21:56
Beserious
阅读(1348)
推荐(0) 编辑
leetcode 395. Longest Substring with At Least K Repeating Characters
摘要:Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than
阅读全文
posted @
2017-08-11 16:26
Beserious
阅读(133)
推荐(0) 编辑
leetcode 405. Convert a Number to Hexadecimal
摘要:Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2:
阅读全文
posted @
2017-08-08 15:26
Beserious
阅读(153)
推荐(0) 编辑
leetcode 316. Remove Duplicate Letters
摘要:Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your
阅读全文
posted @
2017-08-07 19:31
Beserious
阅读(200)
推荐(0) 编辑
leetcode 209. Minimum Size Subarray Sum
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't
阅读全文
posted @
2017-08-03 18:35
Beserious
阅读(144)
推荐(0) 编辑
160. Intersection of Two Linked Lists
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in
阅读全文
posted @
2017-07-26 13:28
Beserious
阅读(134)
推荐(0) 编辑
169. Majority Element
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
posted @
2017-07-26 12:14
Beserious
阅读(128)
推荐(0) 编辑
189. Rotate Array
摘要: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 to [5,6,7,1,2,3,4]. Not
阅读全文
posted @
2017-07-25 18:35
Beserious
阅读(103)
推荐(0) 编辑
172. Factorial Trailing Zeroes
摘要:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 求n得阶层,末尾0的个数 老问题了,统计2,5的
阅读全文
posted @
2017-07-25 15:21
Beserious
阅读(71)
推荐(0) 编辑
167. Two Sum II - Input array is sorted (二分ortwo-pointer)
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function
阅读全文
posted @
2017-07-25 11:54
Beserious
阅读(117)
推荐(0) 编辑
125. Valid Palindrome
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan
阅读全文
posted @
2017-07-24 17:30
Beserious
阅读(144)
推荐(0) 编辑
Algorithmic Crush
摘要:evendra在9号云上看到了他的教练朝他微笑。 每次教授选出Devendra单独问他一个问题,Devendra朦胧的头脑里全是他的教练和她的微笑,以至于他无法专注于其他事情。帮助他解决这个问题:给你一个长度为N的列表,列表的初始值全是0。对此列表,你要进行M次查询,输出列表种最终N个值的最大值。对
阅读全文
posted @
2017-03-15 15:47
Beserious
阅读(536)
推荐(0) 编辑
POJ 1852 Ants
摘要:Ants Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 15617 Accepted: 6753 Description An army of ants walk on a horizontal pole of length l
阅读全文
posted @
2016-11-06 22:20
Beserious
阅读(172)
推荐(0) 编辑