- 博客(19)
- 收藏
- 关注
原创 java中compareTo用法
1、字符串比较(1)逐个字符依次比较,当前位置字符不同时,直接返回ASCII码差值;(2)两个字符串前 lim (limt = min(len1, len2)) 个字符相等时,返回两个字符串长度的差值; 下面是String类封装的方法: /* * @param anotherString the {@code String} to be compared...
2020-03-01 20:18:03 339
原创 Python 进度条
方法一 :from tqdm import tqdmdata_size = 100for i in tqdm(range(data_size+1)): # 在输出下一个进度前,停止0.05秒 time.sleep(0.05)方法二:import timedata_size = 100start = time.perf_counter() for...
2018-11-28 22:17:57 513
原创 Python 计算程序运行时间
import time#time.perf_counter()#返回计时器的精准时间(系统的运行时间),包含整个系统的睡眠时间start = time.perf_counter()'''代码段'''end = time.perf_counter()print("time consuming : %.2fs"%(end - start))import time#ti...
2018-11-28 21:02:37 291
原创 Leetcode 91. Decode Ways
91. Decode WaysA message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, det
2017-12-04 19:48:33 208
原创 LeetCode 139. Word Break
139. Word BreakGiven a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more diction
2017-10-30 19:53:13 154
原创 LeetCode 212. Word Search II
212. Word Search IIGiven a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adja
2017-10-18 15:15:26 181
原创 LeetCode 79. Word Search
79. Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horiz
2017-10-17 11:15:36 193
原创 LeetCode 76. Minimum Window Substring
76. Minimum Window SubstringGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T =
2017-10-11 18:51:35 170
原创 LeetCode 135. Candy
135. CandyThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must
2017-10-10 17:07:23 162
原创 LeetCode 38. Count and Say
38. Count and SayThe count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one
2017-10-10 15:10:25 148
原创 LeetCode 290. Word Pattern
290. Word PatternGiven a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a n
2017-10-10 11:12:00 202
原创 LeetCode 313. Super Ugly Number
313. Super Ugly NumberWrite a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. Fo
2017-09-30 13:18:56 146
原创 LeetCode 378. Kth Smallest Element in a Sorted Matrix
378. Kth Smallest Element in a Sorted MatrixGiven a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that i
2017-09-25 16:14:49 164
原创 LeetCode 264. Ugly Number II
264. Ugly Number IIWrite a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12
2017-09-25 15:21:26 141
原创 LeetCode 515. Find Largest Value in Each Tree Row
515. Find Largest Value in Each Tree RowYou need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \
2017-09-20 22:07:54 226
原创 LeetCode 542. 01 Matrix
542. 01 MatrixGiven a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example 1: Input:0 0 00 1 00 0 0
2017-09-20 19:45:03 230
原创 LeetCode 529. Minesweeper
529. MinesweeperLet's play the minesweeper game (Wikipedia, online game)!You are given a 2D char matrix representing the game board. 'M' represents an unrevealed mine, 'E' represents an un
2017-09-20 15:52:41 234
原创 LeetCode 675. Cut Off Trees for Golf Event
675. Cut Off Trees for Golf EventYou are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map:0 represents the obstacle can't
2017-09-19 16:41:33 786
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人