{"id":21473167,"url":"https://github.com/imsushant12/gfg-solutions","last_synced_at":"2025-10-29T02:14:22.526Z","repository":{"id":49858744,"uuid":"364130182","full_name":"imsushant12/GFG-Solutions","owner":"imsushant12","description":"GFG Solutions of DSA Sheet.","archived":false,"fork":false,"pushed_at":"2022-12-22T06:35:21.000Z","size":396,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T01:35:23.040Z","etag":null,"topics":["algorithms","data-structures","data-structures-algorithms","data-structures-and-algorithms","dsa-algorithm"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imsushant12.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}},"created_at":"2021-05-04T03:37:39.000Z","updated_at":"2024-12-22T12:02:57.000Z","dependencies_parsed_at":"2023-01-30T06:01:08.197Z","dependency_job_id":null,"html_url":"https://github.com/imsushant12/GFG-Solutions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imsushant12/GFG-Solutions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsushant12%2FGFG-Solutions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsushant12%2FGFG-Solutions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsushant12%2FGFG-Solutions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsushant12%2FGFG-Solutions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imsushant12","download_url":"https://codeload.github.com/imsushant12/GFG-Solutions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsushant12%2FGFG-Solutions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265419694,"owners_count":23761858,"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":["algorithms","data-structures","data-structures-algorithms","data-structures-and-algorithms","dsa-algorithm"],"created_at":"2024-11-23T10:15:04.370Z","updated_at":"2025-10-29T02:14:17.505Z","avatar_url":"https://github.com/imsushant12.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview-\nThe goal is to have in a single place for all possible ***GeeksForGeeks*** : **Competitive Programming** solutions - in multiple languages. We aim to achieve this collaboratively, so feel free to contribute in any way you want!.\n\n# GuideLine For Contribution-\nPlease create an issue if you wish to add code in a language that is not currently here. Do not create folders in your submissions unless specifically told to do so.\n\n# Problems:\n\n- [Add 1 to number represented by Linked List [CPP]](Add_1_to_number_represented_by_linked_list.cpp)\n- [Add two numbers represented by linked lists [CPP]](Add_two_numbers_represented_by_linked_lists.cpp)\n- [Array to BST [CPP]](Array_to_BST.cpp)\n- [Binary Tree to BST [CPP]](Binary_Tree_to_BST.cpp)\n- [Binary Tree to DLL [CPP]](Binary_Tree_to_DLL.cpp)\n- [Binary Tree to DLL [JAVA]](Binary_Tree_to_DLL.java)\n- [Bipartite Graph [CPP]](Bipartite_Graph.cpp)\n- [Bottom View of Binary Tree [CPP]](Bottom_View_of_Binary_Tree.cpp)\n- [Boundary Traversal of binary tree [CPP]](Boundary_Traversal_of_binary_tree.cpp)\n- [Brothers From Different Roots [CPP]](Brothers_from_Different_Roots.cpp)\n- [Check if a given graph is tree or not[CPP]](Check_if_a_given_graph_is_tree_or_not.cpp)\n- [Check if it is possible to survive on Island [CPP]](Check_if_it_is_possible_to_survive_on_Island.cpp)\n- [Check if Circular Linked List [CPP]](Check_If_Circular_Linked_List.cpp)\n- [Check if Tree is Isomorphic [CPP]](Check_if_Tree_is_Isomorphic.cpp)\n- [Check Mirror in N-ary tree [CPP]](Check_Mirror_in_N-ary_tree.cpp)\n- [Check for BST [CPP]](Check_for_BST.cpp)\n- [Check for Balanced Tree [CPP]](Check_for_Balanced_Tree.cpp)\n- [Check for path more than K-length from source to any other vertex [CPP]](Check_for_path_more_than_K_length_from_source.cpp)\n- [Check if Linked List is Palindrome [CPP]](Check_if_Linked_List_is_Palindrome.cpp)\n- [Check whether BST contains Dead End [CPP]](Check_whether_BST_contains_Dead_End.cpp)\n- [Chocolate Distribution Problem [CPP]](Chocolate_Distribution_Problem.cpp)\n- [Choose and Swap [CPP]](Choose_and_Swap.cpp)\n- [Clone a linked list with next and random pointer [CPP]](Clone_a_linked_list_with_next_and_random_pointer.cpp)\n- [Common elements [CPP]](Common_elements.cpp)\n- [Construct Binary Tree from String with bracket [CPP]](Construct_Binary_Tree_from_String_with_bracket.cpp)\n- [Construct BST from preorder [CPP]](Construct_BST_from_preorder.cpp)\n- [Construct Tree from Inorder and Preorder [CPP]](Construct_Tree_from_Inorder\u0026Preorder.cpp)\n- [Convert a normal BST to Balanced BST [CPP]](Convert_normal_BST_to_Balanced_BST.cpp)\n- [Count Inversions [CPP]](Count_Inversions.cpp)\n- [Count Squares [CPP]](Count_Squares.cpp)\n- [Count BST nodes that lie in given range [CPP]](Count_nodes_that_lie_in_given_range.cpp)\n- [Count pairs with given sum [CPP]](Count_pairs_with_given_sum.cpp)\n- [Count triplets in sorted DLL with sum equal to X [CPP]](Count_triplets_in_sorted_DLL_with_sum_equal_to_X.cpp)\n- [Cyclically rotate an array by one [CPP]](Cyclically_rotate_an_array_by_one.cpp)\n- [Delete nodes having greater value on right [CPP]](Delete_nodes_having_greater_value_on_right.cpp)\n- [Deletion from Circular Linked List [CPP]](Deletion_from_Circular_Linked_List.cpp)\n- [Detect Loop in linked list [CPP]](Detect_Loop_in_linked_list.cpp)\n- [Determine if Two Trees are Identical [CPP]](Determine_if_Two_Trees_are_Identical.cpp)\n- [Diameter of Binary Tree in O(n) [CPP]](Diameter_of_Binary_Tree_in_O-n.cpp)\n- [Diameter of Binary Tree in O(n*n) [CPP]](Diameter_of_Binary_Tree_in_O-nxn.cpp)\n- [Duplicate subtree in Binary Tree [CPP]](Duplicate_subtree_in_Binary_Tree.cpp) \n- [Evaluation of Postfix Expression [CPP]](Evaluation_of_Postfix_Expression.cpp)\n- [Expression contains redundant bracket or not](Expression_contains_redundant_bracket_or_not.cpp)\n- [Factorials of large numbers [CPP]](Factorials_of_large_numbers.cpp)\n- [Find Missing And Repeating [CPP]](Find_Missing_And_Repeating.cpp)\n- [Given n appointments, find all conflicting appointments [CPP]](Find_all_conflicting_appointments_out_of_N.cpp)\n- [Find duplicates in an array [CPP]](Find_duplicates_in_an_array.cpp)\n- [Find largest subtree sum in a tree [CPP]](Find_largest_subtree_sum_in_a_tree.cpp)\n- [Find maximum meetings in one room-Greddy [CPP]](Find_maximum_meetings_in_one_room-Greddy.cpp)\n- [Find maximum sum possible equal sum of three stacks [CPP]](Find_maximum_sum_possible_equal_sum_of_three_stacks.cpp)\n- [Find minimum and maximum element in an array [PYTHON]](Find_minimum_and_maximum_element_in_an_array.py)\n- [Find whether it is possible to finish all tasks or not from given dependencies [CPP]](Find_whether_it_is_possible_to_finish_all_tasks_or_not_from_given_dependencies.cpp)\n- [First and last occurrences of X [CPP]](First_and_last_occurrences_of_X.cpp)\n- [First node of loop in list [CPP]](First_node_of_loop_in_list.cpp)\n- [First non-repeating character in a stream [CPP]](First_non-repeating_character_in_a_stream.cpp)\n- [Flatten BST to a list [CPP]](Flatten_BST_to_list.cpp)\n- [Flatten BST to a sorted list [CPP]](Flatten_BST_to_sorted_list.cpp)\n- [Flattening a Linked List [CPP]](Flattening_a_Linked_List.cpp)\n- [Fractional Knapsack [CPP]](Fractional_Knapsack.cpp)\n- [Given a linked list of 0s, 1s and 2s, sort it. [CPP]](Given_a_linked_list_of_0s_1s_and_2s-sort_it.cpp)\n- [Hamiltonian Path [CPP]](Hamiltonian_Path.cpp)\n- [Height of Binary Tree [CPP]](Height_of_Binary_Tree.cpp) \n- [Huffman Encoding [CPP]](Huffman_Encoding.cpp)\n- [Implement two stacks in an array [CPP]](Implement_two_stacks_in_an_array.cpp)\n- [Inorder of Tree Iterative [CPP]](Inorder_of_Tree_Iterative.cpp)\n- [Insert a node in a BST [CPP]](Insert_a_node_in_a_BST.cpp)\n- [Insertion at the end of stack [CPP]](Insertion_at_the_end_of_stack.cpp)\n- [Intersection Point in Y Shaped Linked Lists [CPP]](Intersection_Point_in_Y_Shaped_Linked_Lists.cpp)\n- [Intersection Point in Y Shaped Linked Lists Approach-2 [CPP]](Intersection_Point_in_Y_Shaped_Linked_Lists_Approach-2.cpp)\n- [Intersection of two arrays [CPP]](Intersection_of_two_arrays.cpp)\n- [Intersection of two sorted Linked lists [CPP]](Intersection_of_two_sorted_Linked_lists.cpp) \n- [Job Sequencing Problem [CPP]](Job_Sequencing_Problem.cpp)\n- [K largest elements [CPP]](K_largest_elements.cpp)\n- [Kth-ancestor of a node in binary tree [CPP]](Kth-ancestor_of_a_node_in_binary_tree.cpp)\n- [Kth Smallest Largest Element using HEAP [CPP]](Kth_Smallest-Largest_Element_HEAP.cpp)\n- [Kth largest element in BST [CPP]](Kth_largest_element_in_BST.cpp)\n- [Kth smallest element in BST [CPP]](Kth_smallest_element_in_BST.cpp)\n- [Largest BST [CPP]](Largest_BST.cpp)\n- [Leaf at Same Level [CPP]](Leaf_at_Same_Level.cpp)\n- [Left View of Binary Tree [CPP]](Left_View_of_Binary_Tree.cpp)\n- [Level Order Traversal [CPP]](Level_Order_Traversal.cpp)\n- [Lowest Common Ancestor in BST [CPP]](Lowest_Common_Ancestor_in_BST.cpp)\n- [Lowest Common Ancestor in a Binary Tree [CPP]](Lowest_Common_Ancestor_in_a_Binary_Tree.cpp)\n- [Maximize sum arr[i]xi of an Array [CPP]](Maximize_sum-[arr[i]*i]_of_an_Array.cpp)\n- [Maximize sum after K negations [CPP]](Maximize_sum_after_K-negations.cpp)\n- [Maximum Rectangular Area in a Histogram [CPP]](Maximum_Rectangular_Area_in_a_Histogram.cpp)\n- [Maximum Stocks if i stocks to be bought on i-th day [CPP]](Maximum_Stocks_if_i_stocks_bought_on_i-th_day.cpp)\n- [Maximum and Minimum of Array Elements [CPP]](Maximum_and_Minimum_of_Array_Elements.cpp)\n- [Maximum level sum in Binary Tree [CPP]](Maximum_level_sum_in_Binary_Tree.cpp)\n- [Maximum product subset of an array [CPP]](Maximum_product_subset_of_an_array.cpp)\n- [Maximum sum of absolute difference of any permutation [CPP]](Maximum_sum_of_absolute_difference_of_any_permutation.cpp)\n- [Maximum sum of non-adjacent nodes of BT [CPP]](Maximum_sum_of_non-adjacent_nodes_of_BT.cpp)\n- [Maximum trains for which stoppage can be provided [CPP]](Maximum_trains_for_which_stoppage_can_be_provided.cpp)\n- [Median of BST without extra-space and in O(n) time [CPP]](Median_of_BST_without_extra-space.cpp)\n- [Merge K sorted linked lists [CPP]](Merge_K-sorted_linked_lists.cpp)\n- [Merge Overlapping Intervals [CPP]](Merge_Overlapping_Intervals.cpp)\n- [Merge Sort for Linked List [JAVA]](Merge_Sort_for_Linked_List.java)\n- [Merge two BST's [CPP]](Merge_two_BST.cpp)\n- [Merge two Balanced BSTs [CPP]](Merge_two_balanced_BSTs.cpp)\n- [Middle of Three [CPP]](Middle_of_Three.cpp)\n- [Min distance between two given nodes of a Binary Tree [CPP]](Min_distance_between_two_given_nodes_of_a_Binary_Tree.cpp)\n- [Minimum Cost of ropes [CPP]](Minimum_Cost_of_ropes.cpp)\n- [Minimum Cost to cut board into squares [CPP]](Minimum_Cost_to_cut_board_into_squares.cpp)\n- [Minimum Platforms [CPP]](Minimum_Platforms.cpp)\n- [Minimum element in BST [CPP]](Minimum_element_in_BST.cpp)\n- [Minimum sum of absolute difference of pairs of two arrays [CPP]](Minimum_sum_of_absolute_difference_of_pairs_of_two_arrays.cpp)\n- [Minimum swap required to convert binary tree to binary search tree[CPP]](Minimum_swap_required_to_convert_binary_tree_to_binary_search_tree.cpp)\n- [Mirror of binary tree [CPP]](Mirror_of_binary_tree.cpp)\n- [Move last element to front of given Linked List [CPP]](Move_last_element_to_front_of_given_Linked_List.cpp)\n- [Multiply two linked lists [CPP]](Multiply_two_linked_lists.cpp)\n- [N meetings in one room [CPP]](N-meetings_in_one_room.cpp)\n- [Negative weight cycle or BellmanFord Algorithm [JAVA]](Negative_weight_cycle.cpp)\n- [Next Greater Element [CPP]](Next_Greater_Element.cpp)\n- [Nth node from end of linked list [CPP]](Nth_node_from_end_of_linked_list.cpp)\n- [Number of 1 Bits [CPP]](Number_of_1_Bits.cpp)\n- [Page Faults in LRU [CPP]](Page_Faults_in_LRU.cpp)\n- [Pairs with given sum in doubly linked list [CPP]](Pairs_with_given_sum_in_doubly_linked_list.cpp)\n- [Palindrome String [CPP]](Palindrome_String.cpp)\n- [Parenthesis Checker [CPP]](Parenthesis_Checker.cpp)\n- [Populate Inorder Successor for all nodes [CPP]](Populate_Inorder_Successor_for_all_nodes.cpp)\n- [Postorder of Tree Iterative-1 using Stack [CPP]](Postorder_of_Tree_Iterative-1_Stack.cpp)\n- [Postorder of Tree Iterative-2 using Stack [CPP]](Postorder_of_Tree_Iterative-2_Stack.cpp)\n- [Predecessor and Successor [CPP]](Predecessor_and_Successor.cpp)\n- [Preorder of Tree Iterative [CPP]](Preorder_of_Tree_Iterative.cpp)\n- [Preorder to Postorder [CPP]](Preorder_to_Postorder.cpp)\n- [Print all k-sum paths in a binary tree [CPP]](Print_all_k-sum_paths_in_a_binary_tree.cpp)\n- [Print nodes between two given levels of Binary Tree [CPP]](Print_nodes_between_two_given_levels_of_Binary_Tree.cpp)\n- [Print nodes between two given levels of Binary Tree using Queue [CPP]](Print_nodes_between_two_given_levels_of_Binary_Tree_using_Queue.cpp)\n- [Program for Shortest Job First [CPP]](Program_for_Shortest_Job_First.cpp)\n- [Quick Sort on Linked List [CPP]](Quick_Sort_on_Linked_List.cpp)\n- [Rearrange Characters [CPP]](Rearrange_characters.cpp)\n- [Remove duplicate element from sorted Linked List [CPP]](Remove_duplicate_element_from_sorted_Linked_List.cpp)\n- [Remove duplicates from an unsorted linked list [CPP]](Remove_duplicates_from_an_unsorted_linked_list.cpp)\n- [Remove loop in Linked List [CPP]](Remove_loop_in_Linked_List.cpp)\n- [Replace Element with Greatest Element on its Right [CPP]](Replace_Element_with_Greatest_Element_on_its_Right.cpp)\n- [Reverse DLL in groups of a given size [CPP]](Reverse_DLL_in_groups_of_given_size.cpp)\n- [Reverse Level Order Traversal [CPP]](Reverse_Level_Order_Traversal.cpp)\n- [Reverse a Doubly Linked List [CPP]](Reverse_a_Doubly_Linked_List.cpp)\n- [Reverse a Linked List in groups of given size [CPP]](Reverse_a_Linked_List_in_groups_of_given_size.cpp)\n- [Reverse a String [CPP]](Reverse_a_String.cpp)\n- [Reverse a linked list [CPP]](Reverse_a_linked_list.cpp)\n- [Reverse a stack using recursion [CPP]](Reverse_a_stack-using_recursion.cpp) \n- [Reverse a string using Stack [CPP]](Reverse_a_string_using_Stack.cpp)\n- [Right View of Binary Tre [CPP]](Right_View_of_Binary_Tre.cpp)\n- [Rotate Doubly linked list by N nodes [CPP]](Rotate_Doubly_linked_list_by_N_nodes.cpp)\n- [Second Largest [CPP]](Second_largest.cpp)\n- [Segregate even and odd nodes in a Link List [CPP]](Segregate_even_and_odd_nodes_in_a_Link_List.cpp)\n- [Shop in Candy Store [CPP]](Shop_in_Candy_Store.cpp)\n- [Smallest number [CPP]](Smallest_number.cpp)\n- [Smallest subset with sum greater than all other elements [CPP]](Smallest_subset_with_sum_greater_than_all_other_elements.cpp)\n- [Sort a K-sorted DLL [CPP]](Sort_a_K-sorted_DLL.cpp)\n- [Sort a stack [CPP]](Sort_a_stack.cpp)\n- [Sort an array of 0s 1s and 2s [CPP]](Sort_an_array_of_0s_1s_and_2s.cpp)\n- [Sorted matrix [CPP]](Sorted_matrix.cpp)\n- [Special Stack [CPP]](Special_Stack.cpp)\n- [Spirally traversing a matrix [CPP]](Spirally_traversing_a_matrix.cpp)\n- [Split a Circular Linked List into two halves [CPP]](Split_a_Circular_Linked_List_into_two_halves.cpp)\n- [Stack using two queues [CPP]](Stack_using_two_queues.cpp)\n- [Stack with operations on middle element [CPP]](Stack_with_operations_on_middle_element.cpp)\n- [Steps by Knight [CPP]](Steps_by_Knight.cpp)\n- [String is a valid shuffle of 2 strings or not [CPP]](String_is_a_valid_shuffle_of_2_strings_or_not.cpp)\n- [String is shuffled substring of other string [CPP]](String_is_shuffled_substring_of_other_string.cpp)\n- [Sum Tree [CPP]](Sum_Tree.cpp)\n- [Sum of the Longest Bloodline of a Tree [CPP]](Sum_of_the_Longest_Bloodline_of_a_Tree.cpp)\n- [Swap and Maximize [CPP]](Swap_and_Maximize.cpp)\n- [The Celebrity Problem [CPP]](The_Celebrity_Problem.cpp)\n- [Top View of Binary Tree [CPP]](Top_View_of_Binary_Tree.cpp)\n- [Top View of a Binary Tree [CPP]](Top_View_of_a_Binary_Tree.cpp)\n- [Topological Sort [CPP]](Topological_Sort.cpp)\n- [Transform to Sum Tree [CPP]](Transform_to_Sum_Tree.cpp)\n- [Triplet Sum in Array [CPP]](Triplet_Sum_in_Array.cpp)\n- [Union of two arrays [CPP]](Union_of_two_arrays.cpp)\n- [Union of two arrays [PYTHON]](Union_of_two_arrays.py)\n- [Valid Substring [CPP]](Valid_Substring.cpp)\n- [Value equal to Index value [CPP]](Value_equal_to_Index_value.cpp)\n- [Zero Sum Subarrays [CPP]](Zero_Sum_Subarrays.cpp)\n- [ZigZag Tree Traversal [CPP]](ZigZag_Tree_Traversal.cpp) \n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsushant12%2Fgfg-solutions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimsushant12%2Fgfg-solutions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsushant12%2Fgfg-solutions/lists"}