- 博客(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 277
原创 Python 进度条
方法一 : from tqdm import tqdm data_size = 100 for i in tqdm(range(data_size+1)): # 在输出下一个进度前,停止0.05秒 time.sleep(0.05) 方法二: import time data_size = 100 start = time.perf_counter() for...
2018-11-28 22:17:57 476
原创 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 256
原创 Leetcode 91. Decode Ways
91. Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, det
2017-12-04 19:48:33 183
原创 LeetCode 139. Word Break
139. Word Break Given 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 134
原创 LeetCode 212. Word Search II
212. Word Search II Given 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 158
原创 LeetCode 79. Word Search
79. Word Search Given 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 174
原创 LeetCode 76. Minimum Window Substring
76. Minimum Window Substring Given 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 150
原创 LeetCode 135. Candy
135. Candy There 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 148
原创 LeetCode 38. Count and Say
38. Count and Say The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one
2017-10-10 15:10:25 135
原创 LeetCode 290. Word Pattern
290. Word Pattern Given 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 184
原创 LeetCode 313. Super Ugly Number
313. Super Ugly Number Write 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 132
原创 LeetCode 378. Kth Smallest Element in a Sorted Matrix
378. Kth Smallest Element in a Sorted Matrix Given 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 144
原创 LeetCode 264. Ugly Number II
264. Ugly Number II Write 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 128
原创 LeetCode 515. Find Largest Value in Each Tree Row
515. Find Largest Value in Each Tree Row You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \
2017-09-20 22:07:54 173
原创 LeetCode 542. 01 Matrix
542. 01 Matrix Given 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 0 0 1 0 0 0 0
2017-09-20 19:45:03 212
原创 LeetCode 529. Minesweeper
529. Minesweeper Let'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 205
原创 LeetCode 675. Cut Off Trees for Golf Event
675. Cut Off Trees for Golf Event You 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 758
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人