代码
duanjinlong、
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Angular+ionic 相关用法
[ngStyle]基本用法<div [ngStyle]="{'background-color':'green'}"></<div>判断添加<div [ngStyle]="{'background-color':username === 'zxc' ? 'green' : 'red' }"></<div>[n...原创 2020-04-14 11:43:55 · 299 阅读 · 0 评论 -
877. Stone Game 石头游戏 (未完成)
Alex and Lee play a game with piles of stones. There are an even number ofpilesarranged in a row, and each pile has a positive integer number of stonespiles[i].The objective of the game is to en...原创 2019-12-26 15:53:34 · 231 阅读 · 0 评论 -
516. Longest Palindromic Subsequence 最长回文子串
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.Example 1:Input:"bbbab"Output:4One possible longest palindromic s...原创 2019-12-24 11:25:31 · 162 阅读 · 0 评论 -
494. Target Sum 目标和
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 should choose one from+and-as its new symbol.Find out how m...原创 2019-12-23 16:50:41 · 151 阅读 · 0 评论 -
1277. Count Square Submatrices with All Ones 一个矩阵中有多少个正方形子矩阵
Given am * nmatrix of ones and zeros, return how manysquaresubmatrices have all ones.Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1]]Output: 15Explanation: There are 10...原创 2019-12-19 17:02:10 · 788 阅读 · 0 评论 -
416. Partition Equal Subset Sum 分割两个和相等的子串
Given anon-emptyarray containingonly positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array elem...原创 2019-12-19 15:52:47 · 304 阅读 · 0 评论 -
413. Arithmetic Slices 算数切片
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmetic sequence:...原创 2019-12-18 10:22:24 · 144 阅读 · 0 评论 -
377. Combination Sum IV 累加和
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4The pos...原创 2019-12-17 16:18:41 · 169 阅读 · 0 评论 -
376. Wiggle Subsequence 起伏的子串
A sequence of numbers is called awiggle sequenceif the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos...原创 2019-12-16 18:46:12 · 218 阅读 · 0 评论 -
368. Largest Divisible Subset 最大可除子集
Given a set ofdistinctpositive integers, find the largest subset such that every pair (, ) of elements in this subset satisfies:% = 0 or % = 0.If there are multiple solutions, return any sub...原创 2019-12-16 17:09:44 · 466 阅读 · 0 评论 -
357. Count Numbers with Unique Digits 完全不重复的数
Given anon-negativeinteger n, count all numbers with unique digits, x, where 0 ≤ x < .Example:Input: 2Output: 91 Explanation: The answer should be the total numbers in the range of 0 ≤ x &...原创 2019-12-13 11:01:16 · 287 阅读 · 0 评论 -
343. Integer Break 拆分和后求最大积
Given a positive integern, break it into the sum ofat leasttwo positive integers and maximize the product of those integers. Return the maximum product you can get.Example 1:Input: 2Output: 1...原创 2019-12-12 16:26:28 · 148 阅读 · 0 评论 -
338. Counting Bits 二进制中1的个数
Given a non negative integer numbernum. For every numbersiin the range0 ≤ i ≤ numcalculate the number of 1's in their binary representation and return them as an array.Example 1:Input: 2Out...原创 2019-12-12 11:19:32 · 220 阅读 · 0 评论 -
322. Coin Change 硬币筹钱
You are given coins of different denominations and a total amount of moneyamount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money ...原创 2019-12-12 10:31:10 · 144 阅读 · 0 评论 -
304. Range Sum Query 2D - Immutable 二维数组指定区域的和
Given a 2D matrixmatrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1,col1) and lower right corner (row2,col2).The above rectangle (with the red borde...原创 2019-12-10 12:16:27 · 178 阅读 · 0 评论 -
300. Longest Increasing Subsequence 最长自增子序列
Given an unsorted array of integers, find the length of longest increasing subsequence.Example:Input: [10,9,2,5,3,7,101,18]Output: 4 Explanation: The longest increasing subsequence is [2,3,7,1...原创 2019-12-09 16:57:35 · 175 阅读 · 0 评论 -
279. Perfect Squares 最少数量的平方和
Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.Example 1:Input: n = 12Output: 3 Explanation: 12 = 4 + 4 + 4.Example...原创 2019-12-09 11:41:21 · 329 阅读 · 0 评论 -
264. Ugly Number II 丑数
Write a program to find then-th ugly number.Ugly numbers arepositive numberswhose prime factors only include2, 3, 5.Example:Input: n = 10Output: 12Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 1...原创 2019-12-06 11:51:19 · 172 阅读 · 0 评论 -
221. Maximal Square 最大正方形
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.Example:Input: 1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Output: 4题意:找出矩阵中全部由1...原创 2019-12-05 16:48:25 · 208 阅读 · 0 评论 -
139. Word Break 分词
Given anon-emptystringsand a dictionarywordDictcontaining a list ofnon-emptywords, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.Note:The ...原创 2019-12-03 17:37:27 · 165 阅读 · 0 评论 -
91. Decode Ways 翻译数字
A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given anon-emptystring containing only digits, determine t...原创 2019-12-02 23:27:25 · 178 阅读 · 0 评论 -
64. Minimum Path Sum 最小和路径
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:You can only move either down or right at a...原创 2019-11-28 10:26:41 · 165 阅读 · 0 评论 -
63. Unique Paths II 到达终点的路径总数
A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo...原创 2019-11-27 11:55:01 · 220 阅读 · 0 评论 -
62. Unique Paths
A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo...原创 2019-11-26 11:41:46 · 167 阅读 · 0 评论 -
5. Longest Palindromic Substring 最长回文子串
Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Exam...原创 2019-11-25 12:27:56 · 162 阅读 · 0 评论 -
1025. Divisor Game
Alice and Bob take turns playing a game, with Alice starting first.Initially, there is a numberNon the chalkboard. On each player's turn, that player makes amoveconsisting of:Choosinganyxw...原创 2019-11-22 11:59:55 · 178 阅读 · 0 评论 -
746. Min Cost Climbing Stairs 爬梯最小花费
On a staircase, thei-th step has some non-negative costcost[i]assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of ...原创 2019-11-15 16:12:30 · 165 阅读 · 0 评论 -
392. Is Subsequence 是否为子串
Given a stringsand a stringt, check ifsis subsequence oft.You may assume that there is only lower case English letters in bothsandt.tis potentially a very long (length ~= 500,000) string,...原创 2019-11-14 22:35:53 · 164 阅读 · 0 评论 -
303. Range Sum Query - Immutable 查询区间和
Given an integer arraynums, find the sum of the elements between indicesiandj(i≤j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sum...原创 2019-11-11 22:58:24 · 153 阅读 · 0 评论 -
198. House Robber 213. House Robber II 隔家盗窃
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house...原创 2019-11-11 21:08:08 · 244 阅读 · 0 评论 -
记录被安卓环境坑了3天的经历
不知为何,中途跑去使用Android Studio开发了一段时间,之前的基于Angular2+Ionic2开发的项目打包时就一直报错,根据错误提示各种搜索解决方案还是无济于事,没办法只能把新建项目,把代码拉下来重新配置环境。记录一下填坑步骤:1.JAVA环境:版本是1.8,很早就配置好了,这个没问题。2.Android SDK环境:之前是随便配的,后来使用Android Studio下...原创 2019-09-26 12:49:08 · 541 阅读 · 1 评论 -
MAC中ionic2项目安装配置Android环境
1.安装JAVA JDK下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html(需要翻墙)下载好后根据安装提示进行安装即可配置JAVA环境:1)命令行输入 sudo vim .bash_profile2)输入i开始编辑文件3)空白处输入...原创 2019-06-19 11:29:00 · 324 阅读 · 0 评论 -
129. Sum Root to Leaf Numbers 跟到叶子结点的总和
题目:从根节点到叶子节点的数值累乘相加作为一个叶子节点的和,求所有叶子节点和的总和。思路:可以考虑有深度优先DFS啊和广度优先BFS两种算法。代码:DFS:class Solution {public: int sumNumbers(TreeNode* root) { if(!root) { return 0;...原创 2019-05-31 22:50:20 · 142 阅读 · 0 评论 -
118、119 Pascal's Triangle 杨辉三角形
118:列出杨辉三角形所有层119:列出杨辉三角形指定层根据杨辉三角形公式,可得出result[col]=result[col-1]*(rowIndex-col+1)/col118代码:vector<vector<int>> generate(int numRows) { vector<vector<int>&g...原创 2019-05-23 17:07:05 · 136 阅读 · 0 评论 -
angular2+ionic2调用百度翻译API程序
参考百度翻译API提供的相关文档,拟实现基于anguler2+ionic2框架的翻译程序在程序的实现过程中主要学习了以下几点:1.将JS示例程序移植到angular2框架中;2.angular2调用JS脚本;3.运用了jsonp进行网络请求。官网给出的是一个html格式的demo:<!doctype html><head> <met...原创 2019-04-09 16:28:35 · 414 阅读 · 0 评论 -
110. Balanced Binary Tree
题目要求某节点的两个子节点的深度(最深深度)差是否超过1。最开始没弄清题意,以为是求最深节点与最浅节点的差,后来仔细读题发现是求两个子节点,但为什么是对比两个子节点的最深深度,目前不是很清楚。思路:令叶子节点的深度为1;然后一直递归至根节点。每到一个节点就对比左右子节点的最深深度,若深度差大于1,则返回-1表示已经有节点不满足,然后一直递归到根节点。代码:class Solu...原创 2018-11-21 20:16:31 · 119 阅读 · 0 评论
分享