Given a string containing only digits, restore it by returning all possible valid IP address combinations. For…
标签:LeetCode
LeetCode[6] - Count Primes
方法很牛逼也很数学。没做的时候可能想不到。做了之后就觉得,哎,我去,有道理啊。 简而言之:简历一个boolean长条,存isPrime[]。 然后从i=2, 全部变true. 然后利用这个因子的性质,非prime满足条件…
LeetCode刷题之Climbing Stairs
Problem You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 …
[LintCode][System Design] Web Logger
Problem More Discussions Implement a web logger, which provide two methods: hit(timestamp), record a hit at gi…
LeetCode算法题-Maximum Product of Three Numbers(Java实现)
这是悦乐书的第275次更新,第291篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第143题(顺位题号是628)。给定一个整数数组,从其中找出三个数,使得乘积最大。例如: 输入:[1,2,3…
2018-06-30 3. Longest Substring Without Repeating Characters
题意:给你一个字符串,找到里面不包含相同字符的最长子串。 解题思路: 思路一:暴力,(loop1)从第一个字符开始,(loop2)字符数量从1到n,(loop3)判断每个子串是否符合条件。时间复杂度为O(n * n * …
LeetCode 6. ZigZag Conversion
The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (y…
Leetcode 208. Implement Trie (Prefix Tree)
Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist…
Leetcode. Maximum Size Subarray Sum Equals k
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn…
922. 按奇偶排序数组 II
922. 按奇偶排序数组 II 问题 给定一个非负整数数组 , 中一半整数是奇数,一半整数是偶数。 对数组进行排序,以便当为奇数时,也是奇数;当 为偶数时,也是偶数。 你可以返回任何满足上述条件的数组作为答案。 示例: …
Leetcode 211. Add and Search Word - Data structure design
Design a data structure that supports the following two operations: void addWord(word) bool search(word) searc…
Leetcode 223. Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bott…