算法入门
算法入门
is.lizhichao
这个作者很懒,什么都没留下…
展开
-
543. Diameter of Binary Tree
543. Diameter of Binary Tree题目:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes ...原创 2019-11-01 12:31:50 · 178 阅读 · 0 评论 -
451. Sort Characters By Frequency
451. Sort Characters By FrequencyGiven a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:“tree” Output:“eert” Explanation:‘e’ appears twice while ‘r...原创 2019-10-28 09:08:26 · 123 阅读 · 0 评论 -
304. Range Sum Query 2D - Immutable
304. Range Sum Query 2D - ImmutableQS:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2)....原创 2019-10-20 11:09:11 · 116 阅读 · 0 评论 -
115. Distinct Subsequences
115. Distinct Subsequences题目描述:Given a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which is formed from the orig...原创 2019-10-20 09:33:00 · 114 阅读 · 0 评论 -
阶乘的精确值
阶乘的精确值在我们使用c/c++日常编程中,我们会看到很多整数溢出的情况。而在Java中有BigInteger对象,Python中一行代码解决(*^_^*);那么在c语言中如果运算结果非常大,我们可以用数组来存储整数,模拟手算的方法来进行大整数之间的四则运算。先解决一个阶乘的问题问题:输入一个不超过1000的正整数n,输出n!=1×2×3×4×5×6...×n的精确结果。样例输入:15...原创 2019-09-20 10:47:04 · 281 阅读 · 0 评论