[Easy] Floor in a Sorted Array

Given a sorted array having no duplicates, arr[] and a value, x, find floor of x in given array.
Floor of x is the largest element in arr[] such that the element is smaller than or equal to x. If floor exists, then return index of it, else return -1.

More …

[Easy] Two numbers with sum closest to zero

Given an integer array, you need to find the two elements such that their sum is closest to zero.

Input:
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is N,the size of array
Each test case consist of a N integers which are the array elements.

Output:
Print the two numbers in ascending order such that their sum is closest to zero.

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 1000
-100007 ≤ a[i] ≤ 100007

Example:
Input
3
3
-8 -66 -60
6
-21 -67 -37 -18 4 -65
2
-24 -73

Output
-60 -8
-18 4
-73 -24

More …

[Easy] Perfect Numbers

Given a number and check if a number is perfect or not. A number is said to be perfect if sum of all its factors excluding the number itself is equal to the number.

More …

[Basic] Remove character

Given two strings s1 & s2, remove those characters from first string which are present in second string. Both the strings are different and contain only lowercase characters.

More …

[Easy] Anagram

Given two strings, check whether two given strings are anagram of each other or not. An anagram of a string is another string that contains same characters, only the order of characters can be different. For example, “act” and “tac” are anagram of each other.

More …