Title: Contains Duplicate II Source: leetcode.com Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k. Java solution Java /* https://leetcode.com/problems/contains-duplicate-ii/ */ import java.util.HashMap; public class ...

Title: Contains Duplicate Source: leetcode.com Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. Java solution Java /* https://leetcode.com/problems/contains-duplicate/ */ import java.util.HashSet; public class ContainsDuplicate { public ...

Title: Container With Most Water Source: leetcode.com Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such ...

Title: Clone Graph Source: leetcode.com Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. Nodes are labeled uniquely. Java solution Java /* https://leetcode.com/problems/clone-graph/ */ import java.util.HashMap; import java.util.List; import java.util.ArrayList; public class CloneGraph { public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { if(node==null) return null; HashMap<Integer, UndirectedGraphNode> visited = ...

Title: Climbing Stairs Source: leetcode.com You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Java solution Java /* https://leetcode.com/problems/climbing-stairs/ */ import java.util.HashSet; class ClimbStairs { HashSet set = ...

Title: Add Digits Source: leetcode.com Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do ...

Title: Bulls and Cows Source: leetcode.com You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret ...

Hello Everyone, We finally bring you the much awaited review of the super hyped and ‘The Flagship Killer’ titled mobile phone device. The One from OnePlus. While the specs are astonishing compared to its contemporary phones, with 3 GB RAM, Qualcomm Snapdragon 2.5 GHz Quad Core CPU chip, 13 MP Rear and 5MP front camera, ...

prerequisite 1. VMWare Player (Oracle VM box didn’t work for me) Download VMWare Player 2. Cloudera Quick Start VM Download Cloudera Quick Start VM 3. Download CH02 example java code from here. 4. create a folder BigDataAssignment1/code(name it whatever you want) inside /home/cloudera/workspace/ 5. Download hadoop-core-0.20.2.jar from here and place it inside code folder you ...