Skip to content

Latest commit

 

History

History
56 lines (52 loc) · 5.58 KB

File metadata and controls

56 lines (52 loc) · 5.58 KB

0. Write a program to print "Hello World!".

1. Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 2000 and 3200 (both included).The numbers obtained should be printed in a comma-separated sequence on a single line.

2. Write a program which can compute the factorial of a given numbers.The results should be printed in a comma-separated sequence on a single line.Suppose the following input is supplied to the program: 8 Then, the output should be:40320

3. Program to reverse the case of input string.

4. Write a program to convert a matrix to its Row Echleon form.

5. Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.

6. Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.

7. Write a program that accepts a sequence of whitespace separated words as input and prints the words after removing all duplicate words and sorting them alphanumerically.

8. Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence.

9. Write a program, which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.The numbers obtained should be printed in a comma-separated sequence on a single line.

10. Write a program that accepts a sentence and calculate the number of letters and digits.

11. Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.

12.

A website requires the users to input username and password to register. Write a program to check the validity of password input by users.

Following are the criteria for checking the password:

  • At least 1 letter between [a-z]
  • At least 1 number between [0-9]
  • At least 1 letter between [A-Z]
  • At least 1 character from [$#@]
  • Minimum length of transaction password: 6
  • Maximum length of transaction password: 12

13. Write a program to compute the frequency of the words from the input. The output should output after sorting the key alphanumerically.

14. Define a function that can convert a integer into a string and print it in console.

15. Define a function that can receive two integer numbers in string form and compute their sum and then print it in console.

16. Define a function that can accept two strings as input and concatenate them and then print it in console.

17. Define a function that can accept two strings as input and print the string with maximum length in console. If two strings have the same length, then the function should print all strings line by line.

18. Define a function which can generate and print an array where the values are square of numbers between 1 and 20 (both included).

19. Given an array of n elements that contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space.

20. You are given a list of n-1 integers and these integers are in the range of 1 to n. There are no duplicates in the list. One of the integers is missing in the list. Write an efficient code to find the missing integer.

21. Given two sorted arrays, the task is to merge them in a sorted manner.

22. Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number.

23. Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum.

24. Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

25. Design a stack that supports getMin() in O(1) time and O(1) extra space.

26. Given an array and an integer K, find the maximum for each and every contiguous subarray of size k.

27. Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then the inversion count is 0, but if the array is sorted in the reverse order, the inversion count is the maximum. Formally speaking, two elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j

28. Given a stack, sort it using recursion. Use of any loop constructs like while, for .etc is not allowed. We can only use the ADT functions on Stack

29. Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. n can be greater than d or lesser than d.

30. For a given array count combination of pairs of (x,y) whose sum is N.

31. Find the contiguous sub-array in an array which has the largest sum

32. Implement Radix Sort

33. Implement Bucket Sort

34. Implement Bogo Sort

35. Implement Quantum Sort

36. Given two strings, determine if they are isomorphic

37. Generate a list of all permutation of a string

38. Implement Counting Sort

39. Given a string, determine the length of the longest substring which does not have duplicated characters

40. Write a program to multiply two matrices (Assume they are compatible).

41. Write a program to check if entered vectors are linearly independent.

42. Write a program to check if a number entered is an Armstrong Number.

43. Write a function to remove duplicate characters from string.