
leetcode
文章平均质量分 78
iterate7
阳春布德泽,咱能生光辉?
百川东到海,不能复西归,
少壮要努力,以免徒伤悲!
展开
-
leetcode:316. Remove Duplicate Letters 题解
题目 Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical ord原创 2018-02-01 20:50:38 · 2182 阅读 · 0 评论 -
leetcode 697. Degree of an Array 题解(数组的度)
题目 Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length o原创 2018-02-03 21:25:18 · 630 阅读 · 0 评论 -
编辑距离edit distance
定义 编辑距离是字符串之间的一种距离度量,也称为Levenshtein距离;这种距离的含义是:通过最少的操作把一个字符串变换成另外一个字符串。 一次操作包括:删除、插入和替换一个字符。 编辑距离越小,代表越相似。 例子 将kitten转换成sitting的步骤: 1. kitten->sitten(替换k->s) 2. sitten->sittin(替换e->...原创 2018-03-15 11:10:40 · 436 阅读 · 0 评论 -
异或XOR的再理解以及在leetcode上的应用
异或 0和0异或产生0,0和1; 1和0异或得到1;1和1异或得到0。 简单总结:不同的产生1;否则0。代表的是差别。 补充AND,OR。 AND 0&0=0 1&1=1 0&1=0 只有两个同时满足才能满足。 OR 0|0=0 1|1=1 0|1=1 只要有一个满足就满足。 再理解:异或的操作,如同...原创 2018-04-12 14:17:36 · 2163 阅读 · 1 评论 -
leetcode 807. Max Increase to Keep City Skyline(不变天际线的最大化)
题目 In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts...原创 2018-04-30 23:48:44 · 444 阅读 · 1 评论 -
leetcode 68:Text Justification(Round Robin算法应用 )
题目 Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your words in a greedy a...原创 2018-05-13 23:02:35 · 623 阅读 · 0 评论