This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "id": { | |
| "part1": 2963619239934918700, | |
| "part2": -7667152611242860000 | |
| }, | |
| "type": 1, | |
| "start": 1457462272933, | |
| "end": 1457464068396, | |
| "query": "select count(w.wcmo_deal.`ITX$DEAL_NAME`)\nfrom dfs.parquet.wcmo_deal w\nwhere w.wcmo_deal.`ITX$DEAL_FULL_DEALNAME` = 'Foo Capital CLO IV'", | |
| "plan": "00-00 Screen : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {813738.1999999998 rows, 2906207.6 cpu, 0.0 io, 2.040655872E8 network, 0.0 memory}, id = 5131\n00-01 Project(EXPR$0=[$0]) : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {813738.0999999999 rows, 2906207.5 cpu, 0.0 io, 2.040655872E8 network, 0.0 memory}, id = 5130\n00-02 StreamAgg(group=[{}], EXPR$0=[COUNT($0)]) : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {813738.0999999999 rows, 2906207.5 cpu, 0.0 io, 2.040655872E8 network, 0.0 memory}, id = 5129\n00-03 UnionExchange : rowType = RecordType(ANY $f0): rowcount = 49820.7, cumulative cost = {7639 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "id": { | |
| "part1": 2963627498632330000, | |
| "part2": 8315362010375190000 | |
| }, | |
| "type": 1, | |
| "start": 1457460349275, | |
| "end": 1457460428040, | |
| "query": "select count(w.wcmo_deal.`ITX$DEAL_NAME`)\nfrom dfs.`appdata`.clo_test w\nwhere w.wcmo_deal.`ITX$DEAL_FULL_DEALNAME` = 'Foo Capital CLO IV'", | |
| "plan": "00-00 Screen : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {7.894571610000001E8 rows, 2.59147895475E9 cpu, 0.0 io, 4096.0 network, 0.0 memory}, id = 3498\n00-01 Project(EXPR$0=[$0]) : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {7.894571609000001E8 rows, 2.59147895465E9 cpu, 0.0 io, 4096.0 network, 0.0 memory}, id = 3497\n00-02 StreamAgg(group=[{}], EXPR$0=[$SUM0($0)]) : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = {7.894571609000001E8 rows, 2.59147895465E9 cpu, 0.0 io, 4096.0 network, 0.0 memory}, id = 3496\n00-03 UnionExchange : rowType = RecordType(BIGINT EXPR$0): rowcount = 1.0, cumulative cost = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Find in-order successor of node with value | |
| * | |
| * @param root Root of BST | |
| * @param k Value to find successor for | |
| * @return Optional successor | |
| */ | |
| def inOrderSuccessor(root: Node, k: Int): Option[Node] = { | |
| var curr = root | |
| var greaterParent: Node = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Given an unsorted array, remove the minimum number | |
| * of elements from either side until 2*min > max | |
| * | |
| * Return the number of removals | |
| */ | |
| trait RemoveMinimumElements { | |
| /** | |
| * Returns a matrix where matrix[i][j] indicates whether | |
| * the subarray arr[i..j] satisfies the condition 2*min > max |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def recursivelyRemoveAdjacentDuplicates(s: String): String = { | |
| def remove(start: String, end: String, last: Char): String = { | |
| if (end.length == 0) { | |
| start | |
| } else if (start.length == 0) { | |
| if (last == end.head) remove("", end.tail, last) else remove("" + end.head, end.tail, 0) | |
| } else if (start.last == end.head) { | |
| remove(start.init, end.tail, start.last) | |
| } else if (end.length == 1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Minimum number of swaps to rearrange to adjacent pairs | |
| * http://www.geeksforgeeks.org/minimum-number-of-swaps-required-for-arranging-pairs-adjacent-to-each-other/ | |
| * | |
| * @param arr Array of integers | |
| * @param pairings Map of pairs | |
| * @return Tuple of the minimum number of swaps and the rearrangements with minimal | |
| * swaps such that each rearrangement is a list of adjacent pairs | |
| */ | |
| def minSwapsForAdjacentPairs(arr: Array[Int], pairings: Map[Int, Int]): (Int, Seq[Seq[Int]]) = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.hackerearth.com/submission/1808199/ | |
| /* IMPORTANT: class must not be public. */ | |
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| import java.util.ArrayList; | |
| import java.util.HashSet; | |
| import java.util.List; | |
| import java.util.Set; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.hackerearth.com/submission/34813/ | |
| import java.io.*; | |
| import java.util.*; | |
| import java.lang.Math.*; | |
| class ques3 | |
| { | |
| public static void main(String args[])throws Exception | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.hackerearth.com/submission/34845/ | |
| #include <cstdio> | |
| #include <algorithm> | |
| #include <cstring> | |
| #include <set> | |
| #include <vector> | |
| #include <queue> | |
| #include <map> | |
| #include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def palindromePartitions(s: String): Seq[Seq[String]] = { | |
| val n = s.length - 1 | |
| def isPalindrome(i: Int, j: Int): Boolean = | |
| i >= j || s.charAt(i) == s.charAt(j) && isPalindrome(i + 1, j - 1) | |
| // Palindromes starting at s[i] | |
| def partition(i: Int): Seq[Seq[String]] = | |
| if (i == n + 1) Seq(Seq()) | |
| else for { |