-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequirements.py
More file actions
122 lines (122 loc) · 4.86 KB
/
Copy pathrequirements.py
File metadata and controls
122 lines (122 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#1) Write code to check a String is palindrome or not? (solution)
#A palindrome is those String whose reverse is equal to the original. This can be done by using either StringBuffer reverse() method or by technique demonstrated in the solution here.##
#
#
#2) Write a method which will remove any given character from a String? (solution)
#hint: you can remove a given character from String by converting it into a character array and then using substring() method for removing them from output string.
#
#
#3) Print all permutation of String both iterative and Recursive way? (solution)
#
#
#4) Write a function to find out longest palindrome in a given string? (solution)
#
#
#5) How to find the first non repeated character of a given String? (solution)
#
#
#6) How to count the occurrence of a given character in a String? (solution)
#
#
#7) How to check if two String are Anagram? (solution)
#
#
#8) How to convert numeric String to int in Java? (solution)
#
#
#9) In an array 1-100 numbers are stored, one number is missing how do you find it? (solution)
#
#
#10) In an array 1-100 exactly one number is duplicate how do you find it? (solution)
#
#
#11) In an array 1-100 multiple numbers are duplicates, how do you find it? (solution)
#One trick in this programming questions is by using HashMap or Hashtable, we can store a number as key and its occurrence as value if the number is already present in Hashtable then increment its value or insert value as 1 and later on print all those numbers whose values are more than one.
#
#
#12) Given two arrays, 1,2,3,4,5 and 2,3,1,0,5 find which number is not present in the second array.
#Here is a quick tip to solve this programming question: put the elements of the second array in the Hashtable and for every element of the first array, check whether it’s present in the hash or not, O/P all those elements from the first array that are not present in the hash table
#
#
#13) How do you find the second highest number in an integer array? (solution)
#
#
#14) How to find all pairs in an array of integers whose sum is equal to the given number? (solution)
#
#
#15) How to remove duplicate elements from the array in Java? (solution)
#
#
#16) How to find the largest and smallest number in an array? (solution)
#
#
#17) How to find the top two maximum number in an array? (solution)
#
#
#23) Write a program to sort numbers in place using quick sort? (solution)
#
#
#24) Write a program to implement a binary search algorithm in Java or C++? (solution)
#
#
#26) Write code to implement Insertion Sort in Java? (solution)
#
#
#27) Write code to implement Bubble Sort in Java? (solution)
#
#
#26) Write code to check whether a no is a power of two or not? (solution)
#
#
#27) Write a program to check whether a number is a palindrome or not? (solution)
#Check out this post which shows how to reverse a number in Java and can be used to find if its palindrome or not.
#
#
#28) Write code to check whether an integer is Armstrong number or not? (solution)
#Here is a Java program to find Armstrong number, you can use the same logic to write code in any other programming language like C and C++.
#
#
#29) Write a program to find all prime number up to a given number? (solution)
#Here is another Java program to find prime numbers and print them. By using logic demonstrated in this program; you can write a similar program in C and C++.
#
#
#30) Write a function to compute Nth Fibonacci number? Both iterative and recursive? (solution)
#You can check this Java program to print Fibonacci Series using recursion and iteration.
#
#
#31) How to check if a number is binary? (solution)
#For this question, you need to write a function which will accept an integer and return true if it contains only 0 and 1 e.g. if the input is 123 then your function will return false, for 101 it should return true.
#
#32) How to reverse an integer in Java? (solution)
#
#
#33) How to count a number of set bits in given integer? (solution)
#
#
#34) How to find the sum of digits of a number using recursion? (solution)
#
#
#35) How to swap two numbers without using temp variable? (solution)
#
#
#36) How to find the largest of three integers in Java? (solution)
#
#
#37) Write a program to find prime factors of an integer? (solution)
#
#
#38) How to add two integers without using arithmetic operator? (solution)
#
#31) Write a program to find out if two rectangles R1 and R2 are overlapping? (solution)
#
#
#32) You need to write a function to climb n steps you can climb either 1 step at a time or 2 steps a time, write a function to return a number of ways to climb a ladder with n step. (solution)
#It's actually a Fibonacci series so you can solve it like that.
#
#33) Write code for Generate Random No in a range from min to max? (solution)
#
#
#34) Write a program for word-wrap which should work on any screen size? (solution)
#
#
#35) Design an algorithm to find the frequency of occurrence of a word in an article? (solution)