1.1 避免使用 GroupByKey 让我们看一下使用两种不同的方式去计算单词的个数,第一种方式使用 reduceByKey, 另外一种方式使用 groupByKey: val words = Array("one", "two", "two", "three", "three", "three" ...
分类:
其他好文 时间:
2018-11-02 23:37:10
阅读次数:
172
Description Description Write a function that add two numbers A and B. Clarification Are a and b both 32-bit integers? Yes. Can I use bit operation? S ...
分类:
其他好文 时间:
2018-11-02 19:09:05
阅读次数:
180
Root of AVL Tree An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at mo ...
分类:
其他好文 时间:
2018-11-02 01:44:39
阅读次数:
184
Given two non negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Example 1: In ...
分类:
其他好文 时间:
2018-11-01 14:09:30
阅读次数:
145
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in ...
分类:
其他好文 时间:
2018-11-01 11:46:37
阅读次数:
95
题目大意:给你一棵树,其中点上和边上都有值。定义2-Path为经过一条边最多两次的路径,价值为经过点的权值加和-经过边权值*该边经过次数。4e5组询问,每次询问树上连接x,y两点的2-Path的最大价值。 题解: 一道状态比较多的树形dp。 dp1:记录x点子树内从x到x的最大2-Path的价值-x ...
分类:
其他好文 时间:
2018-11-01 11:45:02
阅读次数:
152
https://leetcode.com/tag/two-pointers/ ...
分类:
其他好文 时间:
2018-11-01 11:32:14
阅读次数:
150
https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87739/Java-Strict-O(N)-Two-Pointer-Solution window分别为1-26 ...
分类:
其他好文 时间:
2018-10-31 12:28:58
阅读次数:
143
Given two arrays, write a function to compute their intersection. Example 1: Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [9,4] Exam ...
分类:
其他好文 时间:
2018-10-31 00:00:59
阅读次数:
181
You are given a map in form of a two dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve ...
分类:
其他好文 时间:
2018-10-30 13:15:38
阅读次数:
129