A message containing letters from A-Z is being encoded to numbers using the following mapping…
分类:LeetCode
LeetCode | Binary Tree Level Order Traversal II
题目: Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie,…
LeetCode 168 Excel Sheet Column Title
题目描述 Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example:…
[Leetcode] Maximal Square 最大正方形
Maximal Square Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containin…
8. 贪心
动态规划: 每一步都进行选择,依赖于子问题的解。通常使用自底向上求解,先求较小的子问题,然后是较大的子问题。 贪心: 每次找出局部最优解。 122. Best Time to Buy and Sell Stock II …
[剑指offer] 替换空格
本文首发于我的个人博客:尾尾部落 题目描述 请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 解题思路 很简单…
279. 完全平方数V2
INVALID 用一个INVALID的数值来表示不可达值. class Solution(object): def numSquares(self, n): """ :type n: int :rtype: int ""…
78. Subsets
78. Subsets 题目 Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The …
[LeetCode] Array Nesting 数组嵌套
A zero-indexed array A consisting of N different integers is given. The array contains all integers in …
[LeetCode] Count Binary Substrings 统计二进制子字符串
Give a string s, count the number of non-empty (contiguous) substrings that have the same number o…
[LeetCode] Minimum Swaps To Make Sequences Increasing 使得序列递增的最小交换
We have two integer sequences A and B of the same non-zero length. We are allowed t…
把字符串转换成整数
题目描述 将一个字符串转换成一个整数,要求不能使用字符串转换整数的库函数。 数值为0或者字符串不是一个合法的数值则返回0 输入描述: 输入一个字符串,包括数字字母符号,可以为空 输出描述: 如果是合法的数值表达则返回该数…