You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-44Lines changed: 34 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,20 @@ Directing to the [Main Website](https://sites.google.com/view/gitam-2210416132-m
5
5
# Contents:
6
6
7
7
-[9th May2019](#9th-may2019)
8
-
-[10th May2019](#10th-may-2019contents)
9
-
-[12th May2019](#)
10
-
-[14th May2019]
11
-
-[15th May2019]
12
-
-[16th May20190]
8
+
-[10th May2019](#10th-may-2019)
9
+
-[12th May2019](#12th-may-2019)
10
+
-[14th May2019](#14th-may-2019)
11
+
-[15th May2019](#15th-may-2019)
12
+
-[16th May20190](#16th-may-2019)
13
+
-[17th May20190](#17th-may-2019)
14
+
-[18th May20190](#18th-may-2019)
15
+
-[19th May20190](#19th-may-2019)
16
+
13
17
---
14
18
15
19
## [9th May2019](#contents)
16
20
17
-
### Problem 1 :
18
-
19
-
Given 2 int values, return True if first parameter is negative and second parameter is positive or vice versa. Except if the third parameter is True, then return True only if first two parameters are negative.
21
+
**Problem statement-01:** Given 2 int values, return True if first parameter is negative and second parameter is positive or vice versa. Except if the third parameter is True, then return True only if first two parameters are negative.
20
22
21
23
**Test Cases**
22
24
@@ -27,45 +29,33 @@ Given 2 int values, return True if first parameter is negative and second parame
27
29
pos_neg(1, 6, True) -> False
28
30
pos_neg(-1, -9, False) -> False
29
31
30
-
### Problem 2 :
31
-
32
-
Create a Random Number Generator which takes the Range(lb, ub) and returns a Random number in the given range. lb < random number < ub
32
+
**Problem statement-02:** Create a Random Number Generator which takes the Range(lb, ub) and returns a Random number in the given range. lb < random number < ub
33
33
34
34
**Test Cases¶**
35
35
36
36
RandomGenerator(1, 100) -> will be in range (1,100)
37
37
38
-
### Problem 3 :
38
+
**Problem statement-03:** Given an integer N, calculate the sum of N random numbers in the range `[0, 1000000000000000)`
39
39
40
-
Given an integer N, calculate the sum of N random numbers in the range `[0, 1000000000000000)`
41
-
42
-
### Problem 4 :
43
-
44
-
Design a procedure to perform Linear search on list of N unsorted unique numbers. It take an array and the key element to be searched and returns the index of the element of key element if found. Else returns -1
40
+
**Problem statement-04:** Design a procedure to perform Linear search on list of N unsorted unique numbers. It take an array and the key element to be searched and returns the index of the element of key element if found. Else returns -1
45
41
46
42
**Test Cases**
47
43
48
44
linearSearch([1,4,8,0,3,5,6], 3) -> 4
49
45
linearSearch([15, 12, 9, 6, 3, -3], 0) -> -1
50
46
linearSearch([321, 543, 567, 789], 567) -> 2
51
47
52
-
### Problem 5 :
53
-
54
-
Procedure to generate multiplication tables.
48
+
**Problem statement-05:** Procedure to generate multiplication tables.
55
49
56
-
### Problem 6:
57
-
58
-
Procedure to return the list of factors of a given number.
50
+
**Problem statement-06:** Procedure to return the list of factors of a given number.
Design a procedure to determine if a given string is a Palindrome
58
+
**Problem statement-07:** Design a procedure to determine if a given string is a Palindrome
69
59
70
60
**Test Cases**
71
61
@@ -76,67 +66,65 @@ Design a procedure to determine if a given string is a Palindrome
76
66
77
67
## [10th May 2019](#contents)
78
68
79
-
1. Solve the following problems using Recursion and Iteration
69
+
**Problem statement-01:** Solve the following problems using Recursion and Iteration
80
70
81
71
- Power of a number
82
72
- Factorial
83
73
- GCD
84
74
- Towers of Hanoi
85
75
- Generating the nth Fibonacci number
86
76
87
-
2. Define a function to identity the number of times a substring is repeating in a given string
77
+
**Problem statement-02:** Define a function to identity the number of times a substring is repeating in a given string
88
78
89
79
substringCount('str', 'substr') -> 1
90
80
substringCount('1234567891122334455', '3') -> 3
91
81
substringCount('abccddccc', 'cc') -> 3
92
82
substringCount('aaaaaaa', 'aaa' ) -> 5
93
83
94
-
3. Define a function to merge the characters of two strings alternatively. The remaining characters of the longer string are printed in the same order at the end.
84
+
**Problem statement-03:** Define a function to merge the characters of two strings alternatively. The remaining characters of the longer string are printed in the same order at the end.
95
85
96
86
mergeString('abcd', 'abcd') -> 'aabbccdd'
97
87
mergeString('abc', '123456') -> 'a1b2c3456'
98
88
mergeString('0', '123456') -> '0123456'
99
89
100
-
4) Define a function to convert a binary number to the corresponding decimal number
90
+
**Problem statement-04:** Define a function to convert a binary number to the corresponding decimal number
101
91
102
92
binaryToDecimal(1100) -> 12
103
93
binaryToDecimal(1010) -> 10
104
94
binaryToDecimal(111000) -> 56
105
95
106
-
5) Define a function to convert a decimal number to the corresponding binary number
96
+
**Problem statement-05:** Define a function to convert a decimal number to the corresponding binary number
107
97
108
98
decimalToBinary(15) -> 1111
109
99
decimalToBinary(1) -> 1
110
100
111
-
6. Define a function to check if a given year is a leap year. Returns a boolean value
101
+
**Problem statement-06:** Define a function to check if a given year is a leap year. Returns a boolean value
112
102
113
103
2000 -> True
114
104
1900 -> False
115
105
2012 -> True
116
106
2020 -> True
117
107
0200 -> False
118
108
119
-
7. Design a Python script to determine the difference in date for given two dates in YYYY:MM:DD format(0 <= YYYY <= 9999, 1 <= MM <= 12, 1 <= DD <= 31) following the leap year rules. Return the total number of days existing between the two dates.
109
+
**Problem statement-07:** Design a Python script to determine the difference in date for given two dates in YYYY:MM:DD format(0 <= YYYY <= 9999, 1 <= MM <= 12, 1 <= DD <= 31) following the leap year rules. Return the total number of days existing between the two dates.
You are given n words. Some words may repeat. For each word, output its number of occurrences. The output order should correspond with the input order of appearance of the word.
127
+
**Problem statement-01:** You are given n words. Some words may repeat. For each word, output its number of occurrences. The output order should correspond with the input order of appearance of the word.
140
128
141
129
First line of input contains the total number of words n. Next n lines contain words that need to processed.
142
130
@@ -155,7 +143,7 @@ First line of the output should contain the total number distinct words. Second
155
143
156
144
3 2 1
157
145
158
-
2 . **Problem Statement:** Define a function to validate email addresses based on the following rules.
146
+
**Problem statement-02:** Define a function to validate email addresses based on the following rules.
159
147
160
148
- Email should be in the format `username@domain.extension` username must start with an alphabet and can contain lowercase alphabet, digits, hyphen(-) and underscores( \_ ).
161
149
username must not contain special characters, uppercase letters, whitespaces.
@@ -185,7 +173,7 @@ Output must contain contain n lines with either 'Valid' or 'Invalid'
185
173
Valid
186
174
Invalid
187
175
188
-
3 .**Problem Statement:** Define a function that take an array of integers A, and an integer K and returns the longest possible sub-set of A i.e A' such that the sum of no two elements in A' is divisible by K.
176
+
**Problem Statement-03:** Define a function that take an array of integers A, and an integer K and returns the longest possible sub-set of A i.e A' such that the sum of no two elements in A' is divisible by K.
189
177
190
178
**Constraints:**
191
179
First line in input contains the length of A and the integer K. Second line of input contains len(A) space-separated integers.
@@ -204,12 +192,12 @@ Output must contain the length of A' list
204
192
205
193
### Hackathon - Phase 1
206
194
207
-
**Problem Statement-1:** For a given integer N, find the total number of Non - Prime Factors in the range (1, N) (both exclusive) that do not contain the digit 0
195
+
**Problem Statement-01:** For a given integer N, find the total number of Non - Prime Factors in the range (1, N) (both exclusive) that do not contain the digit 0
208
196
209
197
nonPrimeFactorsCount( 100 ) -> 2
210
198
nonPrimeFactorsCount( 50 ) -> 1
211
199
212
-
**Problem Statement-2:** For a given integer N. Find the least positive integer X made up of only 9's and 0's, such that, X is a multiple of N.
200
+
**Problem Statement-02:** For a given integer N. Find the least positive integer X made up of only 9's and 0's, such that, X is a multiple of N.
213
201
214
202
X is made up of one or more occurrences of 9 and zero or more occurrences of 0.
215
203
@@ -264,8 +252,10 @@ X is made up of one or more occurrences of 9 and zero or more occurrences of 0.
264
252
265
253
## [19 May 2019](#contents)
266
254
267
-
**Problem statement:** Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process with the new value of n, terminating when n = 1. For example, the following sequence of numbers will be generated for n = 22:
255
+
**Problem statement-01:** Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process with the new value of n, terminating when n = 1. For example, the following sequence of numbers will be generated for n = 22:
268
256
269
257
22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
270
258
271
-
**Problem statement:** It is conjectured (but not yet proven) that this algorithm will terminate at n = 1 for every integer n. Still, the conjecture holds for all integers up to at least 1, 000, 000. For an input n, the cycle-length of n is the number of numbers generated up to and including the 1. In the example above, the cycle length of 22 is 16. Given any two numbers i and j, you are to determine the maximum cycle length over all numbers between i and j, including both endpoints.
259
+
**Problem statement-02:** It is conjectured (but not yet proven) that this algorithm will terminate at n = 1 for every integer n. Still, the conjecture holds for all integers up to at least 1, 000, 000. For an input n, the cycle-length of n is the number of numbers generated up to and including the 1. In the example above, the cycle length of 22 is 16. Given any two numbers i and j, you are to determine the maximum cycle length over all numbers between i and j, including both endpoints.
0 commit comments