GeeksforGeeks

yesterday at 17:47.
Facebook

[ Geeksforgeeks.org Link ]

Given a sorted array, the task is to remove the duplicate elements from the array.

Input : arr[] = {2, 2, 2, 2, 2}

Output : arr[] = {2}

new size = 1

Input : arr[] = {1, 2, 2, 3, 4, 4, 4, 5, 5}

Output : arr[] = {1, 2, 3, 4, 5}

new size = 5
### Remove duplicates from sorted array - GeeksforGeeks

Given a sorted array, the task is to remove the duplicate elements from the array.

Input : arr[] = {2, 2, 2, 2, 2}

Output : arr[] = {2}

new size = 1

Input : arr[] = {1, 2, 2, 3, 4, 4, 4, 5, 5}

Output : arr[] = {1, 2, 3, 4, 5}

new size = 5

geeksforgeeks.org

GeeksforGeeks

yesterday at 13:30.
Facebook

[ Geeksforgeeks.org Link ]

Tidy Number are those number whose digits are arranged in non-decreasing order. Here, we are given a number and we have to find another number that is smaller but closest to the given number and also that number should be tidy, i.e., their digit should be in non-decreasing order.

Input : 91234

Output : 89999

Tidy property is violated by appearing 1 after 9.

So, we...

View details ⇨
### Find the closest and smaller tidy number - GeeksforGeeks

Tidy Number are those number whose digits are arranged in non-decreasing order. Here, we are given a number and we have to find another number that is smaller but closest to the given number and also that number should be tidy, i.e., their digit should be in non-decreasing order.

Input : 91234

Output : 89999

Tidy property is violated by appearing 1 after 9.

So, we...

View details ⇨

geeksforgeeks.org

GeeksforGeeks

yesterday at 11:07.
Facebook

[ Geeksforgeeks.org Link ]

Flipkart Interview theory and coding practice
### Flipkart Interview Preparation Problems | Practice | GeeksforGeeks

Flipkart Interview theory and coding practice

practice.geeksforgeeks.org

GeeksforGeeks

yesterday at 05:19.
Facebook

[ Geeksforgeeks.org Link ]

Asked in Twitter, Amazon and Samsung

Given an integer N, how many structurally unique binary search trees are there that store values 1...N?

For example, for N = 2, there are 2 unique BSTs

1 2

\ /

2 1

For N = 3, there are 5 possible BSTs

1 3 3 2 1

\ / / ...

View details ⇨
### Unique BST's | Practice | GeeksforGeeks

Asked in Twitter, Amazon and Samsung

Given an integer N, how many structurally unique binary search trees are there that store values 1...N?

For example, for N = 2, there are 2 unique BSTs

1 2

\ /

2 1

For N = 3, there are 5 possible BSTs

1 3 3 2 1

\ / / ...

View details ⇨

practice.geeksforgeeks.org

GeeksforGeeks

yesterday at 03:40.
Facebook

[ Geeksforgeeks.org Link ]

The problem is to convert the given binary number to its equivalent hexadecimal number.

The input could be very large and may not fit even into unsigned long long int.

Input : 110001110

Output : 18E

Input : 1111001010010100001.010110110011011

Output : 794A1.5B36
### Convert a binary number to hexadecimal number - GeeksforGeeks

The problem is to convert the given binary number to its equivalent hexadecimal number.

The input could be very large and may not fit even into unsigned long long int.

Input : 110001110

Output : 18E

Input : 1111001010010100001.010110110011011

Output : 794A1.5B36

geeksforgeeks.org

GeeksforGeeks

05/27/2017 at 18:52.
Facebook

[ Geeksforgeeks.org Link ]

Given two arrays a[] and b[] of same size, we need to swap their contents.

Example :

Input : a[] = {1, 2, 3, 4}

b[] = {5, 6, 7, 8}

Output : a[] = {5, 6, 7, 8}

b[] = {1, 2, 3, 4}
### How to quickly swap two arrays of same size in C++? - GeeksforGeeks

Given two arrays a[] and b[] of same size, we need to swap their contents.

Example :

Input : a[] = {1, 2, 3, 4}

b[] = {5, 6, 7, 8}

Output : a[] = {5, 6, 7, 8}

b[] = {1, 2, 3, 4}

geeksforgeeks.org

GeeksforGeeks

05/27/2017 at 17:32.
Facebook

[ Geeksforgeeks.org Link ]

Given two numbers m and n, count number of m digit numbers that are divisible by n.

Examples:

Input : m = 2

n = 6

Output : 15

Two digit numbers that are divisible by 6

are 12, 18, 24, 30, 36, ....., 96.

Input : m = 3

n = 5

Output :180
### Count of m digit integers that are divisible by an integer n - GeeksforGeeks

Given two numbers m and n, count number of m digit numbers that are divisible by n.

Examples:

Input : m = 2

n = 6

Output : 15

Two digit numbers that are divisible by 6

are 12, 18, 24, 30, 36, ....., 96.

Input : m = 3

n = 5

Output :180

geeksforgeeks.org

GeeksforGeeks

05/27/2017 at 07:46.
Facebook

[ Geeksforgeeks.org Link ]

Given an array of n numbers. Arrange them in a way that yields the largest value. While arranging the order of even numbers with respect to each other and the order of odd numbers with respect to each other should be maintained respectively.

Examples:

Input : {78, 81, 88, 79, 117, 56}

Output : 8179788856117

The numbers are arranged in the order:

81 79 78 88 56 117...

View details ⇨
### Biggest number by arranging numbers in certain order - GeeksforGeeks

Given an array of n numbers. Arrange them in a way that yields the largest value. While arranging the order of even numbers with respect to each other and the order of odd numbers with respect to each other should be maintained respectively.

Examples:

Input : {78, 81, 88, 79, 117, 56}

Output : 8179788856117

The numbers are arranged in the order:

81 79 78 88 56 117...

View details ⇨

geeksforgeeks.org

GeeksforGeeks

05/27/2017 at 06:29.
Facebook

[ Geeksforgeeks.org Link ]

An Amazon interview question for practice
### Print Common Nodes in BST | Practice | GeeksforGeeks

An Amazon interview question for practice

practice.geeksforgeeks.org

GeeksforGeeks

05/27/2017 at 05:24.
Facebook

[ Geeksforgeeks.org Link ]

Given a string, find the all distinct (or non-repeating characters) in it. For example, if the input string is “Geeks for Geeks”, then output should be ‘for’ and if input string is “Geeks Quiz”, then output should be ‘GksQuiz’.

The distinct characters should be printed in same order as they appear in input string.

Examples:

Input : Geeks for Geeks

Output :...

View details ⇨
### Print all distinct characters of a string in order (3 Methods) - GeeksforGeeks

Given a string, find the all distinct (or non-repeating characters) in it. For example, if the input string is “Geeks for Geeks”, then output should be ‘for’ and if input string is “Geeks Quiz”, then output should be ‘GksQuiz’.

The distinct characters should be printed in same order as they appear in input string.

Examples:

Input : Geeks for Geeks

Output :...

View details ⇨

geeksforgeeks.org

GeeksforGeeks

05/27/2017 at 04:17.
Facebook

[ Geeksforgeeks.org Link ]

Given a number n, find out the n-th positive number made up of even digits (0, 2, 4, 6, 8) only. Firs few numbers made of even digits are 0, 2, 4, 6, 8, 20, 22, 24…….

Examples:

Input : 2

Output : 2

Second number made of 0, 2, 4, 6, 8 is 2

Input : 10

Output : 28
### Find the n-th number made of even digits only - GeeksforGeeks

Given a number n, find out the n-th positive number made up of even digits (0, 2, 4, 6, 8) only. Firs few numbers made of even digits are 0, 2, 4, 6, 8, 20, 22, 24…….

Examples:

Input : 2

Output : 2

Second number made of 0, 2, 4, 6, 8 is 2

Input : 10

Output : 28

geeksforgeeks.org

GeeksforGeeks

05/26/2017 at 17:59.
Facebook

[ Geeksforgeeks.org Link ]

Given a BST and a value x the task is to delete the nodes having values greater than or equal to x.
### Delete nodes with key greater than k | Practice | GeeksforGeeks

Given a BST and a value x the task is to delete the nodes having values greater than or equal to x.

practice.geeksforgeeks.org

GeeksforGeeks

05/26/2017 at 17:22.
Facebook

[ Geeksforgeeks.org Link ]

Given a real number between 0 and 1 (e.g., 0.72) that is passed in as a double, print the binary representation. If the number cannot be represented accurately in binary with at most 32 characters, print” ERROR:’
### Converting a Real Number (between 0 and 1) to Binary String - GeeksforGeeks

Given a real number between 0 and 1 (e.g., 0.72) that is passed in as a double, print the binary representation. If the number cannot be represented accurately in binary with at most 32 characters, print” ERROR:’

geeksforgeeks.org

GeeksforGeeks

05/26/2017 at 15:59.
Facebook

[ Geeksforgeeks.org Link ]

A new company added to company preparation page ( [ Geeksforgeeks.org Link ] )
### Cisco Interview Preparation - GeeksforGeeks

A new company added to company preparation page ( [ Geeksforgeeks.org Link ] )

geeksforgeeks.org