1
+ {
2
+ "coding_tasks" : [
3
+ {
4
+ "task" : " Find the factorial of a number" ,
5
+ "example" : {
6
+ "input" : 5 ,
7
+ "output" : " 5! = 120"
8
+ }
9
+ },
10
+ {
11
+ "task" : " Calculate the area of a rectangle" ,
12
+ "example" : {
13
+ "input" : {
14
+ "Length" : 8 ,
15
+ "Width" : 6
16
+ },
17
+ "output" : " Area = 48"
18
+ }
19
+ },
20
+ {
21
+ "task" : " Reverse a string" ,
22
+ "example" : {
23
+ "input" : " hello" ,
24
+ "output" : " olleh"
25
+ }
26
+ },
27
+ {
28
+ "task" : " Check if a string is a palindrome" ,
29
+ "example" : {
30
+ "input" : " racecar" ,
31
+ "output" : " Yes (it's a palindrome)"
32
+ }
33
+ },
34
+ {
35
+ "task" : " Count the number of vowels in a string" ,
36
+ "example" : {
37
+ "input" : " programming" ,
38
+ "output" : 3
39
+ }
40
+ },
41
+ {
42
+ "task" : " Calculate the sum of all prime numbers up to a given number" ,
43
+ "example" : {
44
+ "input" : 10 ,
45
+ "output" : 17
46
+ }
47
+ },
48
+ {
49
+ "task" : " Implement a basic calculator for addition, subtraction, multiplication, and division" ,
50
+ "example" : {
51
+ "input" : " 5 + 3" ,
52
+ "output" : 8
53
+ }
54
+ },
55
+ {
56
+ "task" : " Swap two numbers without using a temporary variable" ,
57
+ "example" : {
58
+ "input" : {
59
+ "a" : 5 ,
60
+ "b" : 7
61
+ },
62
+ "output" : {
63
+ "a" : 7 ,
64
+ "b" : 5
65
+ }
66
+ }
67
+ },
68
+ {
69
+ "task" : " Find the largest element in an array" ,
70
+ "example" : {
71
+ "input" : [3 , 8 , 2 , 10 , 5 ],
72
+ "output" : 10
73
+ }
74
+ },
75
+ {
76
+ "task" : " Calculate the average of elements in an array" ,
77
+ "example" : {
78
+ "input" : [4 , 6 , 8 , 10 ],
79
+ "output" : 7
80
+ }
81
+ },
82
+ {
83
+ "task" : " Implement a binary search algorithm" ,
84
+ "example" : {
85
+ "input" : {
86
+ "Sorted Array" : [1 , 3 , 5 , 7 , 9 ],
87
+ "Target" : 5
88
+ },
89
+ "output" : " Index = 2"
90
+ }
91
+ },
92
+ {
93
+ "task" : " Merge two sorted arrays into a single sorted array" ,
94
+ "example" : {
95
+ "input" : {
96
+ "Array 1" : [2 , 4 , 6 ],
97
+ "Array 2" : [1 , 3 , 5 ]
98
+ },
99
+ "output" : " Merged Array = [1, 2, 3, 4, 5, 6]"
100
+ }
101
+ },
102
+ {
103
+ "task" : " Calculate the nth Fibonacci number using dynamic programming" ,
104
+ "example" : {
105
+ "input" : 6 ,
106
+ "output" : " Fibonacci(6) = 8"
107
+ }
108
+ },
109
+ {
110
+ "task" : " Find the longest common subsequence of two strings" ,
111
+ "example" : {
112
+ "input" : {
113
+ "String 1" : " AGGTAB" ,
114
+ "String 2" : " GXTXAYB"
115
+ },
116
+ "output" : " GTAB"
117
+ }
118
+ },
119
+ {
120
+ "task" : " Reverse a linked list" ,
121
+ "example" : {
122
+ "input" : " 1 -> 2 -> 3 -> 4 -> 5" ,
123
+ "output" : " 5 -> 4 -> 3 -> 2 -> 1"
124
+ }
125
+ },
126
+ {
127
+ "task" : " Implement a queue using two stacks" ,
128
+ "example" : {
129
+ "input" : " Enqueue 1, Enqueue 2, Dequeue" ,
130
+ "output" : " Dequeued item = 1"
131
+ }
132
+ },
133
+ {
134
+ "task" : " Implement a basic file compression algorithm (e.g., Huffman coding)" ,
135
+ "example" : {
136
+ "input" : " aabbbbcc" ,
137
+ "output" : " Compressed Data = \" a2b4c2\" "
138
+ }
139
+ },
140
+ {
141
+ "task" : " Perform matrix multiplication" ,
142
+ "example" : {
143
+ "input" : {
144
+ "Matrix A" : [[1 , 2 ], [3 , 4 ]],
145
+ "Matrix B" : [[5 , 6 ], [7 , 8 ]]
146
+ },
147
+ "output" : {
148
+ "Result" : [[19 , 22 ], [43 , 50 ]]
149
+ }
150
+ }
151
+ },
152
+ {
153
+ "task" : " Detect a cycle in a directed graph" ,
154
+ "example" : {
155
+ "input" : " Graph with cycles" ,
156
+ "output" : " Cycle detected"
157
+ }
158
+ },
159
+ {
160
+ "task" : " Implement a basic web scraper to extract data from a website" ,
161
+ "example" : {
162
+ "input" : " Website URL" ,
163
+ "output" : " Extracted data (e.g., headlines)"
164
+ }
165
+ },
166
+ {
167
+ "task" : " Find the middle element of a linked list" ,
168
+ "example" : {
169
+ "input" : " 1 -> 2 -> 3 -> 4 -> 5" ,
170
+ "output" : " Middle element = 3"
171
+ }
172
+ },
173
+ {
174
+ "task" : " Check if a number is prime" ,
175
+ "example" : {
176
+ "input" : 17 ,
177
+ "output" : " Yes (it's prime)"
178
+ }
179
+ },
180
+ {
181
+ "task" : " Implement a stack with push, pop, and getMin operations in O(1) time" ,
182
+ "example" : {
183
+ "input" : " Push 5, Push 3, Push 7, Pop, GetMin" ,
184
+ "output" : " Min element = 3"
185
+ }
186
+ },
187
+ {
188
+ "task" : " Calculate the greatest common divisor (GCD) of two numbers" ,
189
+ "example" : {
190
+ "input" : {
191
+ "Number 1" : 24 ,
192
+ "Number 2" : 36
193
+ },
194
+ "output" : 12
195
+ }
196
+ },
197
+ {
198
+ "task" : " Find the first non-repeating character in a string" ,
199
+ "example" : {
200
+ "input" : " programming" ,
201
+ "output" : " First non-repeating character = 'r'"
202
+ }
203
+ },
204
+ {
205
+ "task" : " Reverse words in a string" ,
206
+ "example" : {
207
+ "input" : " Hello World" ,
208
+ "output" : " World Hello"
209
+ }
210
+ },
211
+ {
212
+ "task" : " Sort an array in descending order using bubble sort" ,
213
+ "example" : {
214
+ "input" : [5 , 2 , 9 , 1 , 5 , 6 ],
215
+ "output" : [9 , 6 , 5 , 5 , 2 , 1 ]
216
+ }
217
+ },
218
+ {
219
+ "task" : " Implement a singly linked list data structure with basic operations" ,
220
+ "example" : {
221
+ "input" : " Insert 1, Insert 2, Delete 1, Search 2" ,
222
+
223
+
224
+ "output" : " Linked List: 2"
225
+ }
226
+ },
227
+ {
228
+ "task" : " Calculate the power of a number using recursion" ,
229
+ "example" : {
230
+ "input" : {
231
+ "Base" : 2 ,
232
+ "Exponent" : 3
233
+ },
234
+ "output" : 8
235
+ }
236
+ },
237
+ {
238
+ "task" : " Find the kth smallest element in an unsorted array" ,
239
+ "example" : {
240
+ "input" : {
241
+ "Array" : [6 , 3 , 2 , 7 , 1 , 5 ],
242
+ "k" : 3
243
+ },
244
+ "output" : 3
245
+ }
246
+ },
247
+ {
248
+ "task" : " Implement a binary tree data structure with traversal algorithms (in-order, pre-order, post-order)" ,
249
+ "example" : {
250
+ "input" : " Insert 5, Insert 3, Insert 7, In-order traversal" ,
251
+ "output" : " Traversal result: 3, 5, 7"
252
+ }
253
+ }
254
+ ]
255
+ }
0 commit comments