Skip to content

Commit 904ca09

Browse files
committed
Added solution index-> removed template.cpp
1 parent 5c9c3a2 commit 904ca09

10 files changed

+208
-88
lines changed

README.md

+191-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,191 @@
1-
# geeks-for-geeks-solutions
2-
My own solutions of many Geeks For Geeks exercises, solved using C++, Java e python
1+
![Geeks for Geeks](images/geeksforgeeks.png)
2+
3+
# Geeks-for-geeks-solutions
4+
5+
My solutions to algorithmic problems in [Geeks for Geeks](https://auth.geeksforgeeks.org/user/davidepollicino2015/practice/) written using C++, Python and Java
6+
7+
## What you can find in this repository
8+
9+
I have solved quite a number of problems from several topics. See the below table for further details.
10+
11+
## How to contribute?
12+
1. Fork the repository
13+
2. Do the desired changes (add/delete/modify)
14+
3. Make a pull request
15+
16+
## When to contribute?
17+
1. If there is no solution to a problem in the main branch.
18+
2. If your solution is asymptotically faster than the one in the main branch.
19+
3. If your algorithm is of the same time complexity but with reduced code size. In this case, comment out the original solution and make a pull request with your solution.
20+
4. If you have another method of solving the problem which is asymptotically slower than the original method then, comment your solution in the main file and make a pull request.
21+
22+
## Mind that
23+
Constructive criticisms or code reviews of any kind are very much welcome.
24+
25+
If you have any questions about the solutions you can find here, feel free to contact me at: [[email protected]](mailto:[email protected]?subject=[GitHub]%20GeeksForGeeks)
26+
27+
## Algorithms and Data structures : Available
28+
* [Programming foundamental](#Programming-foundamentals)
29+
* [Array](#Array-or-Vector)
30+
* [Vectors](#Array-or-Vector)
31+
* [String](#Strings)
32+
* [Matrix](#Matrix)
33+
* [Linked List](#Linked-List)
34+
* [Stack](#Stack)
35+
* [Queue](#Queue)
36+
* [Binary Search](#Binary-Search)
37+
* [Binary Search Tree](#Binary-Search-Tree)
38+
* [Math](#Math)
39+
40+
## Algorithms and Data structures : Soon online
41+
42+
* Bit Manipulation
43+
* Heap
44+
* Tree
45+
* Hash Table
46+
* Math
47+
* Two Pointers
48+
* Sort
49+
* Recursion
50+
* Breadth-First Search
51+
* Depth-First Search
52+
* Backtracking
53+
* Dynamic Programming
54+
* Greedy
55+
* Graph
56+
57+
58+
## Programming foundamentals
59+
60+
| Name | Solution |
61+
|----------|:----------------:|
62+
|Step-by-step-condition|[C++](c++/step-by-step-condition.cpp)|
63+
|Learn to Comment|[C++](c++/learn-to-comment.cpp)|
64+
|Swap the objects|[C++](c++/swap-the-objects.cpp)|
65+
|While Loop print table|[C++](c++/while-loop-print-table.cpp)|
66+
|Data types in Java|[Java](java/data-types-java.java)|
67+
|Start coding|[Java](java/start-coding.java)|
68+
|The new line|[Java](java/the-new-line.java)|
69+
|Hello Word-python|[Python](python/hello-world.py)|
70+
|Repeatitive printing-python|[Python](python/repeatitive-printing.py)|
71+
|Sep and End|[Python](python/sep-and-end-in-print.py)|
72+
|Sep -Space separate|[Python](python/space-separate.py)|
73+
74+
## Array or Vector
75+
76+
| Name | Solution |
77+
|----------|:----------------:|
78+
|Count Evens and odds|[C++](c++/count-odd-even.cpp)|
79+
|Need some change|[C++](c++/need-some-chage.cpp)|
80+
|Find the frequency|[C++](c++/find-the-frequency.cpp)|
81+
|Immediate smaller element|[C++](c++/immediate-smaller-element.cpp)|
82+
|pair-sum-in-vector|[C++](c++/pair-sum-vector.cpp)|
83+
|rotate-array-by-n-elements|[C++](c++/rotate-array-by-n-element.cpp)|
84+
|Sort and Reverse|[C++](c++/sort-and-reverse.cpp)|
85+
|STL vector|[C++](c++/.cpp)|
86+
87+
## Matrix
88+
89+
| Name | Solution |
90+
|----------|:----------------:|
91+
|Count zeros|[C++](c++/count-zeros.cpp)|
92+
|Transpose matrix|[C++](c++/transpose-of-matrix.cpp)|
93+
|two-dimensional-world|[C++](c++/two-dimensionalworld.cpp)|
94+
95+
## Strings
96+
97+
| Name | Solution|
98+
|----------|:----------------:|
99+
|String validation |[solution.py](python/string/string_validation.py)|
100+
|Hello World|[solution.py](python/helloworld.py)|
101+
|Is Isogram|[C++](c++/isIsogram.cpp)|
102+
|last-index-of-1|[C++](c++/last-index-of-1.cpp)|
103+
|Repeated chars|[C++](c++/repeate-char.cpp)|
104+
|Sort string|[C++](c++/sort-string.cpp)|
105+
|Contatenate String python|[python](python/concatenating-string.py)|
106+
||[]()|
107+
108+
## Linked List
109+
110+
| Name | Solution |
111+
|----------|:----------------:|
112+
|Learning struct|[C++](c++/learning-struct.cpp)|
113+
|Count nodes in Liked List |[C++](c++/count-nodes-of-linked-list.cpp)|
114+
|Count Occurrency|[C++](c++/count-occurrency-linked-list.cpp)|
115+
|Identical Linked List|[C++](c++/identical-Linked-list.cpp)|
116+
|linked-list-length-even-or-odd|[C++](c++/linked-list-lenght-even-or-odd.cpp)|
117+
|Middle Element|[C++](c++/middle-element-linkedlist.cpp)|
118+
|Node at the given position|[C++](c++/node-at-given-pos-linked-list.cpp)|
119+
|Print linked list|[C++](c++/print-linked-list.cpp)|
120+
121+
## Stack
122+
123+
| Name | Solution |
124+
|----------|:----------------:|
125+
|Stack designer|[C++](c++/stack-designer.cpp)|
126+
127+
## Queue
128+
129+
| Name | Solution |
130+
|----------|:----------------:|
131+
|Queue Designer|[C++](c++/queue-designer.cpp)|
132+
133+
## Binary Search
134+
135+
| Name | Solution |
136+
|----------|:----------------:|
137+
|Binary Search |[C++](c++/bin-search.cpp)|
138+
139+
## Binary Search Tree
140+
141+
| Name | Solution |
142+
|----------|:----------------:|
143+
|Binary Search |[C++](c++/bin-search.cpp)|
144+
|Min in BST|[C++](c++/min-in-BST.cpp)|
145+
|Search Element in BST|[C++](c++/search-element-in-bst.cpp)|
146+
|search-a-node-in-bst|[C++](c++/search-node-bst.cpp)|
147+
148+
## Math
149+
150+
| Name | Solution |
151+
|----------|:----------------:|
152+
|armstrong-numbers|[C++](c++/ambstrong.cpp)|
153+
|automorphic numbers|[C++](c++/automorphic-number.cpp)|
154+
|For loop prime check|[C++](c++/for-loop-prime-check.cpp)|
155+
|Int-to-binary|[C++](c++/int-to-binary.cpp)|
156+
|find-prime-numbers-in-a-range|[C++](c++/prime-numbers-in-range.cpp)|
157+
|Strong numbers|[C++](c++/strong-number.cpp)|
158+
|the-dice-problem|[C++](c++/the-dice-problem.cpp)|
159+
160+
# SOON ONLINE
161+
162+
## Bit Manipulation
163+
164+
## Breadth-First Search
165+
166+
## Depth-First Search
167+
168+
## Backtracking
169+
170+
## Dynamic Programming
171+
172+
## Greedy
173+
174+
## Graph
175+
176+
## Heap
177+
178+
## Tree
179+
180+
## Hash Table
181+
182+
## Two Pointers
183+
184+
## Sort
185+
186+
## Recursion
187+
188+
189+
190+
191+

c++/last-index-of-1.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// https://practice.geeksforgeeks.org/problems/last-index-of-1/0
2-
#include <bits/stdc++.h>
2+
#include <iostream>
33
using namespace std;
44

55
void solve_test()
@@ -20,10 +20,7 @@ int main()
2020
int t;
2121
cin >> t;
2222

23-
for(int i=0; i<t; i++)
24-
{
23+
while(t--)
2524
solve_test();
26-
}
27-
2825
return 0;
29-
}
26+
}

c++/learning-struct.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55
struct Node
66
{
7-
//Linked list has data and next members
87
int data;
98
Node *next;
10-
};
9+
};

c++/repeate-char.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ void solve_test()
55
{
66
string s;
77
cin >> s;
8-
98

109
for(int i=0; i<s.size(); i++)
1110
{
@@ -23,13 +22,11 @@ void solve_test()
2322

2423
int main()
2524
{
26-
int t=1;
27-
cin >> t;
25+
unsigned long int test_cases;
26+
cin >> test_cases;
2827

29-
for(int i=0; i<t; i++)
30-
{
28+
while(test_cases--)
3129
solve_test();
32-
}
33-
30+
3431
return 0;
35-
}
32+
}

c++/rotate-array-by-n-elements.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ void solve_test()
2323

2424
int main()
2525
{
26-
short int t;
27-
cin >>t;
28-
for(int i =0; i<t; i++)
29-
{
26+
short int test_cases;
27+
cin >>test_cases;
28+
while(test_cases--)
3029
solve_test();
31-
}
3230
return 0;
33-
}
31+
}
File renamed without changes.

c++/sort-nd-reverrse.cpp

-13
This file was deleted.

c++/the-dice-problem.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ void solve_test()
1111

1212
int main()
1313
{
14-
int t;
15-
cin >> t;
14+
unsigned long int test_cases;
15+
cin >> test_cases;
1616

17-
for(int i=0; i<t; i++)
18-
{
17+
while(test_cases)
1918
solve_test();
20-
}
21-
2219
return 0;
23-
}
20+
}

c++/xoring-and-clearing.cpp

-44
This file was deleted.

images/geeksforgeeks.png

25.2 KB
Loading

0 commit comments

Comments
 (0)