题目: 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 ( ...
分类:
编程语言 时间:
2020-02-12 00:30:01
阅读次数:
62
1 """ 2 Given two strings text1 and text2, return the length of their longest common subsequence. 3 A subsequence of a string is a new string generate ...
分类:
其他好文 时间:
2020-02-12 00:23:03
阅读次数:
70
LeetCode 0167: Two Sum II Input array is sorted【Python】 题目 "英文题目链接" Given an array of integers that is already sorted in ascending order\ , find two n ...
分类:
编程语言 时间:
2020-02-12 00:19:27
阅读次数:
74
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specificat ...
分类:
其他好文 时间:
2020-02-11 19:20:25
阅读次数:
64
这是一道简单应用线段树的题 代码也是书上的,敲一边熟悉一下 #include <iostream>#include <cstdio>using namespace std;const int MAX=1e5+10;long long sum[MAX<<2],add[MAX<<2]; void up_ ...
分类:
其他好文 时间:
2020-02-11 19:07:08
阅读次数:
53
将有序数组转化为二叉搜索树。题目即是题意。只要输出一个有效的BST即可。此题可以跟109题一起做,要求很接近但是做法不太一样。例子, Example: Given the sorted linked list: [-10,-3,0,5,9], One possible answer is: [0,- ...
分类:
其他好文 时间:
2020-02-11 09:53:31
阅读次数:
59
二叉树层序遍历二。题意跟版本一很接近,唯一的不同点是输出的output需要从下往上排列,叶子节点层最先输出,根节点在最后输出。例子, For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return i ...
分类:
其他好文 时间:
2020-02-11 09:30:26
阅读次数:
53
//add,懒标记,给以当前节点为根的子树中的每一个点加上add(不包含根节点) // #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; typedef ...
分类:
其他好文 时间:
2020-02-11 09:22:13
阅读次数:
70
题目: Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents t ...
分类:
编程语言 时间:
2020-02-11 00:19:01
阅读次数:
110
A. Non zero Description: Guy Manuel and Thomas have an array $a$ of $n$ integers [$a_1, a_2, \dots, a_n$]. In one step they can add $1$ to any element ...
分类:
其他好文 时间:
2020-02-10 22:25:52
阅读次数:
87