[Easy] Longest Distinc characters in string
Given a string, find length of the longest substring with all distinct characters. For example, for input “abca”, the output is 3 as “abc” is the longest substring with all distinct characters.
More …Given a string, find length of the longest substring with all distinct characters. For example, for input “abca”, the output is 3 as “abc” is the longest substring with all distinct characters.
More …In a given array A[] find the maximum value of (A[i] – i) - (A[j] – j) where i is not equal to j.
More …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.
Check that the number can be divided by the sum of its digit.
More …Given an array, swap kth element from beginning with kth element from end.
More …Given a number N. Write a program to check whether every bit in the binary representation of the given number is set or not.
More …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
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 …Given an array of integers, write a function that returns true if there is a triplet (a, b, c) that satisfies a2 + b2 = c2.
More …Given a Binary Number, Print its decimal equivalent.
More …You have to merge the two sorted arrays into one sorted array (in non-increasing order)
More …한 가지 일을 꾸준히 하면 어떤 일이 생길까?
More …추후 코드 수정
More …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 …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 …