{"id":20322909,"url":"https://github.com/naemazam/data-structures-and-algorithms-gfg","last_synced_at":"2026-05-19T09:31:18.505Z","repository":{"id":185219252,"uuid":"673185000","full_name":"naemazam/Data-Structures-and-Algorithms-GFG","owner":"naemazam","description":"Data Structures and Algorithms problem and solution from GeekforGeeks with CP Books and Notes","archived":false,"fork":false,"pushed_at":"2023-08-01T04:38:12.000Z","size":8999,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T10:14:42.511Z","etag":null,"topics":["coding-challenge","coding-interviews","cpp","geekforgeeks","geekforgeeks-solutions","interview-practice","interview-preparation","interview-preparation-kit","interview-questions","naemazam","problem-solving","python"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naemazam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-01T04:16:52.000Z","updated_at":"2025-02-12T19:24:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"5322b104-9ef9-4558-90af-b70b731b3b02","html_url":"https://github.com/naemazam/Data-Structures-and-Algorithms-GFG","commit_stats":null,"previous_names":["naemazam/data-structures-and-algorithms-gfg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/naemazam/Data-Structures-and-Algorithms-GFG","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naemazam%2FData-Structures-and-Algorithms-GFG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naemazam%2FData-Structures-and-Algorithms-GFG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naemazam%2FData-Structures-and-Algorithms-GFG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naemazam%2FData-Structures-and-Algorithms-GFG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naemazam","download_url":"https://codeload.github.com/naemazam/Data-Structures-and-Algorithms-GFG/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naemazam%2FData-Structures-and-Algorithms-GFG/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263604010,"owners_count":23487223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coding-challenge","coding-interviews","cpp","geekforgeeks","geekforgeeks-solutions","interview-practice","interview-preparation","interview-preparation-kit","interview-questions","naemazam","problem-solving","python"],"created_at":"2024-11-14T19:25:34.496Z","updated_at":"2026-05-19T09:31:18.459Z","avatar_url":"https://github.com/naemazam.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data-Structures-and-Algorithms-GFG\nData Structures and Algorithms problem and solution from GeekforGeeks with CP Books and Notes\n\n# Interview Data-Structures-and-Algorithms-GFG Problems from GeekforGeeks\n\nThis repository is a collection of my solutions to the must do probelms in [geeksforgeeks](https://www.geeksforgeeks.org/must-do-Data-Structures-and-Algorithms-GFG-questions-for-companies-like-amazon-microsoft-adobe/)\n\n## 0. To get started follow the Books\n  \n  1. [The Data-Structures-and-Algorithms-GFG Book](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Data-Structures-and-Algorithms-GFGBook.pdf)\n  \n  2. [Cracking-the-Data-Structures-and-Algorithms-GFG-Interview-6th-Edition-189-Programming-Questions-and-Solutions](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Cracking-the-Data-Structures-and-Algorithms-GFG-Interview-6th-Edition-189-Programming-Questions-and-Solutions.pdf)\n  \n  3. [Guide to Competitive Programming_ Learning and Improving Algorithms Through Contests](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Guide%20to%20Competitive%20Programming_%20Learning%20and%20Improving%20Algorithms%20Through%20Contests%20(%20PDFDrive.com%20).pdf)\n    \n  \n## 1. Divide and Conquer\n\n  0. [Find the element that appears once in sorted array](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/0_Find_Elements.cpp)\n  \n  1. [Search in a Rotated Array](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/1_Search.cpp)\n  \n  2. [Binaray Search](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/2_Binary_Search.cpp)\n  \n  3. [Sum of Middle Elements of two sorted arrays](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/3_Merge.cpp)\n  \n  4. [Quick Sort](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/4_Quick_Sort.cpp)\n\n  5. [Merge Sort](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/5_Merge_Sort.cpp)\n  \n  6. [K-th element of two sorted Arrays](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Divide%20and%20Conquer/6_K-th_Element.cpp)\n\n## 2. Recursion \n\n  0. [Flood fill Algorithm](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Recursion/0_Flood_Fill.cpp)\n   \n  1. [Number of paths](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Recursion/1_Num_of_Paths.cpp)\n   \n  2. [Combination Sum – Part 2](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Recursion/2_CombnSum.cpp)\n   \n  3. [Special Keyboard](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Recursion/3_Special_keyboard.cpp)\n    \n  4. [Josephus problem](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Recursion/4_Josephus_Problem.cpp)\n  \n## 3. Arrays\n\n   0. [Subarray with given sum](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/0_Rotate_Array.cpp)\n  \n   1. [Count the triplets](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/1_Subarray_Sum.cpp)\n   \n   2. [Kadane’s Algorithm](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/2_Counting_Triplets.cpp)\n   \n   3. [Missing number in array](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/3_Kadane_Algorithm.cpp)\n  \n   4. [Merge two sorted arrays](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/4_Merge_Spaceless.cpp)\n  \n   5. [Rearrange array alternatively](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/5_Rearrange_Array_Alt.cpp)\n   \n   6. [Number of pairs](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/6_Num_Pairs.cpp)\n   \n   7. [Inversion of Array](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/7_Inversion.cpp) \n   \n   8. [Sort an array of 0s, 1s and 2s](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/8_Sort_0s_1s_2s.cpp)\n   \n   9. [Equilibrium point](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/9_Equillibrium_Point.cpp)\n   \n  10. [Leaders in an array](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/10_Leaders.cpp)\n    \n  11. [Minimum Platforms](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/dab51bc33a6837db0a7052d5560b547d90cc6134/Arrays/11_Min_Platforms.cpp)\n  \n  12. [Reverse array in groups](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/12_Rev_Ar_Grps.py).\n  \n  13. [K’th smallest element](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/13_kth_smallest_element.cpp)\n  \n  14. [Trapping Rain Water](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/14_Trapping_Rain.py)\n  \n  15. [Pythagorean Triplet](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/15_Pythogorean_Triplet.py)\n  \n  16. [Chocolate Distribution Problem](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/16_Choclate_dist.py)\n  \n  17. [Stock buy and sell](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/17_Stock_Buy_Sell.py)\n  \n  18. [Element with left side smaller and right side greater](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/18_Middle.py)\n  \n  19. [Convert array into Zig-Zag fashion](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/19_ZigZag.py)\n\n  20. [Last Index of 1](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/20_Last_index_1.py)\n  \n  21. [Spirally traversing a matrix](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/21_Spiral_Traversal.cpp)\n  \n  22. [Largest Number formed from an Array](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Arrays/22_Largest_Num.cpp)\n\n\n## 4. Strings\n\n  0. [Reverse words in a given string](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/0_Reverse_Words.py)\n  \n  1. [Permutations of a given string](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/1_Permutations.py)\n  \n  2. [Longest Palindrome in a String](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/2_Longest_Palindrome.py)\n  \n  3. [Recursively remove all adjacent duplicates](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/3_Remove_Adj_dups.py)\n  \n  4. [Check if string is rotated by two places](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/4_Check_String_Rot.py)\n  \n  5. [Roman Number to Integer](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/5_Roman_to_Int.py)\n  \n  6. [Anagram](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/6_Anagram.py)\n\n  7. [Remove Duplicates](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/7_Rm_Dups.py)\n\n  8. [Form a Palindrome](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/8_Form_Palindrome.py)\n  \n  9. [Longest Distinct Characters in the string](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/9_Distinct_Chars.py)\n  \n  10. [Implement Atoi](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/10_AtoI.py)\n  \n  11. [Implement strstr](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/11_StrStr.py)\n  \n  12. [Longest Common Prefix](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Strings/12_LongCommPrefix.py)\n  \n  \n## 5. Linked List\n  0. [Finding middle element in a linked list](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/0_Find_the_Middle.cpp)\n  1. [Reverse a linked list](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/1_Reverse.cpp)\n  2. [Rotate a Linked List](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/2_Rotate.cpp)\n  3. [Reverse a Linked List in groups of given size](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/3_Reverse_with_k.cpp)\n  4. [Intersection point in Y shaped linked lists](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/4_Find_The_Y_intersection.cpp)\n  5. [Detect Loop in linked list](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/5_Detect_Loop.cpp)\n  6. [Remove loop in Linked List](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/6_Remove_Loop.cpp)\n  7. [N’th node from end of linked list](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/7_Nth_Node_from_End.cpp)\n  8. [Flattening a Linked List](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/8_Flattening_List.cpp)\n  9. [Merge two sorted linked lists](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/9_Merge.cpp)\n  10. [Intersection point of two Linked Lists](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/10_Pairwise_Swap.cpp)\n  11. [Pairwise swap of a linked list](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/11_Add_two_ll_num.cpp)\n  12. [Add two numbers represented by linked lists CPP](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/12_Check_Palindrome.cpp) , [Add two numbers represented by linked lists Java](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/18_Add_two_num.java)\n  13. [Check if Linked List is Palindrome](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/13_Queue.cpp)\n  14. [Implement Queue using Linked List](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/14_Stack.cpp)\n  15. [Implement Stack using Linked List](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/15_Sort_0s1s2s.cpp)\n  16. [Given a linked list of 0s, 1s and 2s, sort it](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/16_Delete_without_head.cpp)\n  17. [Delete without head pointer](https://github.com/naemazam/Data-Structures-and-Algorithms-GFG/blob/master/Linked%20Lists/17_Delete_headless.cpp)\n\n## 6. Stack and Queue\n\n## 7. Tree and BST\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaemazam%2Fdata-structures-and-algorithms-gfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaemazam%2Fdata-structures-and-algorithms-gfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaemazam%2Fdata-structures-and-algorithms-gfg/lists"}