# Why you should move to the Netherlands (as a Software Professional) | Top 5 reasons

Most people these days want to settle abroad. If I go ask any person working in IT sector about what are the countries they are considering for moving and settling abroad, the obvious answers are either the US or Canada.

Let's talk about the US, if you want to work…

# Resume that got me into Amazon as a Software Engineer 2!!

Are you looking for a job change? Do you need kickass resume tips and format that can get you in FAANG companies?

Your search ends here! I am going to share…

# 100. Same Tree — LeetCode Solution

Given two binary trees, write a function to check if they are the same or not.

Two binary trees are considered the same if they are structurally identical and the nodes have the same value.

Example 1:

`Input:     1         1          / \       / \         2   3     2   3        [1,2,3],   [1,2,3]…`

# Square and Cube of array elements using multi-threading

Write a program explaining multiple threads working together to solve a problem:

`1. Create a int[] DataArray of 100 elements with random numbers. 2. Create 5 threads which take the part of elements from DataArray. 3. Those threads should compute the Square[ ] and Cubes[ ] for those respective values…`

# 217. Contains Duplicate — LeetCode Solution

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.

Example 1:

`Input: [1,2,3,1]Output: true`

Example 2:

`Input: [1,2,3,4]Output: false`

Example 3:

`Input: [1,1,1,3,3,4,3,2,4,2]Output: true`

Here is my solution:

`class Solution {    public boolean containsDuplicate(int[] nums) {        Set<Integer> unique = new HashSet<>(nums.length);                for(int i: nums) {            if(unique.contains(i)) {                return true;            }            unique.add(i);        }                return false;    }}`

You can checkout full explanation by watching below video

# 1. Two Sum — LeetCode Solution

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:

`Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].`

Here is my solution:

`class Solution {    public int[] twoSum(int[] nums, int target) {        HashMap<Integer, Integer> map = new HashMap<>();                for (int i=0; i<nums.length; i++) {            int difference = target - nums[i];            if (map.containsKey(difference)) {                return new int[] {map.get(difference), i};            }            map.put(nums[i], i);        }        return new int[] {-1, -1};    }}`

You can checkout full explanation by watching below video

# 202. Happy Number — LeetCode Solution

Write an algorithm to determine if a number `n` is "happy".

A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it…

# Validate IP Address — LeetCode

Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.

IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots (“.”), e.g.,`172.16.254.1`;

Besides, leading zeros in the IPv4…

# 380. Insert Delete GetRandom O(1) — 12th June LeetCode Challenge

Design a data structure that supports all following operations in average O(1) time.

1. `insert(val)`: Inserts an item val to the set if not already present.
2. `remove(val)`: Removes an item val from the set if present.
3. `getRandom`: Returns a random element from current set of elements. …

## Rajdeep Kaur

Get the Medium app