Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imsushant12/gfg-solutions

GFG Solutions of DSA Sheet.
https://github.com/imsushant12/gfg-solutions

algorithms data-structures data-structures-algorithms data-structures-and-algorithms dsa-algorithm

Last synced: about 1 month ago
JSON representation

GFG Solutions of DSA Sheet.

Awesome Lists containing this project

README

        

# Overview-
The 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!.

# GuideLine For Contribution-
Please 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.

# Problems:

- [Add 1 to number represented by Linked List [CPP]](Add_1_to_number_represented_by_linked_list.cpp)
- [Add two numbers represented by linked lists [CPP]](Add_two_numbers_represented_by_linked_lists.cpp)
- [Array to BST [CPP]](Array_to_BST.cpp)
- [Binary Tree to BST [CPP]](Binary_Tree_to_BST.cpp)
- [Binary Tree to DLL [CPP]](Binary_Tree_to_DLL.cpp)
- [Binary Tree to DLL [JAVA]](Binary_Tree_to_DLL.java)
- [Bipartite Graph [CPP]](Bipartite_Graph.cpp)
- [Bottom View of Binary Tree [CPP]](Bottom_View_of_Binary_Tree.cpp)
- [Boundary Traversal of binary tree [CPP]](Boundary_Traversal_of_binary_tree.cpp)
- [Brothers From Different Roots [CPP]](Brothers_from_Different_Roots.cpp)
- [Check if a given graph is tree or not[CPP]](Check_if_a_given_graph_is_tree_or_not.cpp)
- [Check if it is possible to survive on Island [CPP]](Check_if_it_is_possible_to_survive_on_Island.cpp)
- [Check if Circular Linked List [CPP]](Check_If_Circular_Linked_List.cpp)
- [Check if Tree is Isomorphic [CPP]](Check_if_Tree_is_Isomorphic.cpp)
- [Check Mirror in N-ary tree [CPP]](Check_Mirror_in_N-ary_tree.cpp)
- [Check for BST [CPP]](Check_for_BST.cpp)
- [Check for Balanced Tree [CPP]](Check_for_Balanced_Tree.cpp)
- [Check for path more than K-length from source to any other vertex [CPP]](Check_for_path_more_than_K_length_from_source.cpp)
- [Check if Linked List is Palindrome [CPP]](Check_if_Linked_List_is_Palindrome.cpp)
- [Check whether BST contains Dead End [CPP]](Check_whether_BST_contains_Dead_End.cpp)
- [Chocolate Distribution Problem [CPP]](Chocolate_Distribution_Problem.cpp)
- [Choose and Swap [CPP]](Choose_and_Swap.cpp)
- [Clone a linked list with next and random pointer [CPP]](Clone_a_linked_list_with_next_and_random_pointer.cpp)
- [Common elements [CPP]](Common_elements.cpp)
- [Construct Binary Tree from String with bracket [CPP]](Construct_Binary_Tree_from_String_with_bracket.cpp)
- [Construct BST from preorder [CPP]](Construct_BST_from_preorder.cpp)
- [Construct Tree from Inorder and Preorder [CPP]](Construct_Tree_from_Inorder&Preorder.cpp)
- [Convert a normal BST to Balanced BST [CPP]](Convert_normal_BST_to_Balanced_BST.cpp)
- [Count Inversions [CPP]](Count_Inversions.cpp)
- [Count Squares [CPP]](Count_Squares.cpp)
- [Count BST nodes that lie in given range [CPP]](Count_nodes_that_lie_in_given_range.cpp)
- [Count pairs with given sum [CPP]](Count_pairs_with_given_sum.cpp)
- [Count triplets in sorted DLL with sum equal to X [CPP]](Count_triplets_in_sorted_DLL_with_sum_equal_to_X.cpp)
- [Cyclically rotate an array by one [CPP]](Cyclically_rotate_an_array_by_one.cpp)
- [Delete nodes having greater value on right [CPP]](Delete_nodes_having_greater_value_on_right.cpp)
- [Deletion from Circular Linked List [CPP]](Deletion_from_Circular_Linked_List.cpp)
- [Detect Loop in linked list [CPP]](Detect_Loop_in_linked_list.cpp)
- [Determine if Two Trees are Identical [CPP]](Determine_if_Two_Trees_are_Identical.cpp)
- [Diameter of Binary Tree in O(n) [CPP]](Diameter_of_Binary_Tree_in_O-n.cpp)
- [Diameter of Binary Tree in O(n*n) [CPP]](Diameter_of_Binary_Tree_in_O-nxn.cpp)
- [Duplicate subtree in Binary Tree [CPP]](Duplicate_subtree_in_Binary_Tree.cpp)
- [Evaluation of Postfix Expression [CPP]](Evaluation_of_Postfix_Expression.cpp)
- [Expression contains redundant bracket or not](Expression_contains_redundant_bracket_or_not.cpp)
- [Factorials of large numbers [CPP]](Factorials_of_large_numbers.cpp)
- [Find Missing And Repeating [CPP]](Find_Missing_And_Repeating.cpp)
- [Given n appointments, find all conflicting appointments [CPP]](Find_all_conflicting_appointments_out_of_N.cpp)
- [Find duplicates in an array [CPP]](Find_duplicates_in_an_array.cpp)
- [Find largest subtree sum in a tree [CPP]](Find_largest_subtree_sum_in_a_tree.cpp)
- [Find maximum meetings in one room-Greddy [CPP]](Find_maximum_meetings_in_one_room-Greddy.cpp)
- [Find maximum sum possible equal sum of three stacks [CPP]](Find_maximum_sum_possible_equal_sum_of_three_stacks.cpp)
- [Find minimum and maximum element in an array [PYTHON]](Find_minimum_and_maximum_element_in_an_array.py)
- [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)
- [First and last occurrences of X [CPP]](First_and_last_occurrences_of_X.cpp)
- [First node of loop in list [CPP]](First_node_of_loop_in_list.cpp)
- [First non-repeating character in a stream [CPP]](First_non-repeating_character_in_a_stream.cpp)
- [Flatten BST to a list [CPP]](Flatten_BST_to_list.cpp)
- [Flatten BST to a sorted list [CPP]](Flatten_BST_to_sorted_list.cpp)
- [Flattening a Linked List [CPP]](Flattening_a_Linked_List.cpp)
- [Fractional Knapsack [CPP]](Fractional_Knapsack.cpp)
- [Given a linked list of 0s, 1s and 2s, sort it. [CPP]](Given_a_linked_list_of_0s_1s_and_2s-sort_it.cpp)
- [Hamiltonian Path [CPP]](Hamiltonian_Path.cpp)
- [Height of Binary Tree [CPP]](Height_of_Binary_Tree.cpp)
- [Huffman Encoding [CPP]](Huffman_Encoding.cpp)
- [Implement two stacks in an array [CPP]](Implement_two_stacks_in_an_array.cpp)
- [Inorder of Tree Iterative [CPP]](Inorder_of_Tree_Iterative.cpp)
- [Insert a node in a BST [CPP]](Insert_a_node_in_a_BST.cpp)
- [Insertion at the end of stack [CPP]](Insertion_at_the_end_of_stack.cpp)
- [Intersection Point in Y Shaped Linked Lists [CPP]](Intersection_Point_in_Y_Shaped_Linked_Lists.cpp)
- [Intersection Point in Y Shaped Linked Lists Approach-2 [CPP]](Intersection_Point_in_Y_Shaped_Linked_Lists_Approach-2.cpp)
- [Intersection of two arrays [CPP]](Intersection_of_two_arrays.cpp)
- [Intersection of two sorted Linked lists [CPP]](Intersection_of_two_sorted_Linked_lists.cpp)
- [Job Sequencing Problem [CPP]](Job_Sequencing_Problem.cpp)
- [K largest elements [CPP]](K_largest_elements.cpp)
- [Kth-ancestor of a node in binary tree [CPP]](Kth-ancestor_of_a_node_in_binary_tree.cpp)
- [Kth Smallest Largest Element using HEAP [CPP]](Kth_Smallest-Largest_Element_HEAP.cpp)
- [Kth largest element in BST [CPP]](Kth_largest_element_in_BST.cpp)
- [Kth smallest element in BST [CPP]](Kth_smallest_element_in_BST.cpp)
- [Largest BST [CPP]](Largest_BST.cpp)
- [Leaf at Same Level [CPP]](Leaf_at_Same_Level.cpp)
- [Left View of Binary Tree [CPP]](Left_View_of_Binary_Tree.cpp)
- [Level Order Traversal [CPP]](Level_Order_Traversal.cpp)
- [Lowest Common Ancestor in BST [CPP]](Lowest_Common_Ancestor_in_BST.cpp)
- [Lowest Common Ancestor in a Binary Tree [CPP]](Lowest_Common_Ancestor_in_a_Binary_Tree.cpp)
- [Maximize sum arr[i]xi of an Array [CPP]](Maximize_sum-[arr[i]*i]_of_an_Array.cpp)
- [Maximize sum after K negations [CPP]](Maximize_sum_after_K-negations.cpp)
- [Maximum Rectangular Area in a Histogram [CPP]](Maximum_Rectangular_Area_in_a_Histogram.cpp)
- [Maximum Stocks if i stocks to be bought on i-th day [CPP]](Maximum_Stocks_if_i_stocks_bought_on_i-th_day.cpp)
- [Maximum and Minimum of Array Elements [CPP]](Maximum_and_Minimum_of_Array_Elements.cpp)
- [Maximum level sum in Binary Tree [CPP]](Maximum_level_sum_in_Binary_Tree.cpp)
- [Maximum product subset of an array [CPP]](Maximum_product_subset_of_an_array.cpp)
- [Maximum sum of absolute difference of any permutation [CPP]](Maximum_sum_of_absolute_difference_of_any_permutation.cpp)
- [Maximum sum of non-adjacent nodes of BT [CPP]](Maximum_sum_of_non-adjacent_nodes_of_BT.cpp)
- [Maximum trains for which stoppage can be provided [CPP]](Maximum_trains_for_which_stoppage_can_be_provided.cpp)
- [Median of BST without extra-space and in O(n) time [CPP]](Median_of_BST_without_extra-space.cpp)
- [Merge K sorted linked lists [CPP]](Merge_K-sorted_linked_lists.cpp)
- [Merge Overlapping Intervals [CPP]](Merge_Overlapping_Intervals.cpp)
- [Merge Sort for Linked List [JAVA]](Merge_Sort_for_Linked_List.java)
- [Merge two BST's [CPP]](Merge_two_BST.cpp)
- [Merge two Balanced BSTs [CPP]](Merge_two_balanced_BSTs.cpp)
- [Middle of Three [CPP]](Middle_of_Three.cpp)
- [Min distance between two given nodes of a Binary Tree [CPP]](Min_distance_between_two_given_nodes_of_a_Binary_Tree.cpp)
- [Minimum Cost of ropes [CPP]](Minimum_Cost_of_ropes.cpp)
- [Minimum Cost to cut board into squares [CPP]](Minimum_Cost_to_cut_board_into_squares.cpp)
- [Minimum Platforms [CPP]](Minimum_Platforms.cpp)
- [Minimum element in BST [CPP]](Minimum_element_in_BST.cpp)
- [Minimum sum of absolute difference of pairs of two arrays [CPP]](Minimum_sum_of_absolute_difference_of_pairs_of_two_arrays.cpp)
- [Minimum swap required to convert binary tree to binary search tree[CPP]](Minimum_swap_required_to_convert_binary_tree_to_binary_search_tree.cpp)
- [Mirror of binary tree [CPP]](Mirror_of_binary_tree.cpp)
- [Move last element to front of given Linked List [CPP]](Move_last_element_to_front_of_given_Linked_List.cpp)
- [Multiply two linked lists [CPP]](Multiply_two_linked_lists.cpp)
- [N meetings in one room [CPP]](N-meetings_in_one_room.cpp)
- [Negative weight cycle or BellmanFord Algorithm [JAVA]](Negative_weight_cycle.cpp)
- [Next Greater Element [CPP]](Next_Greater_Element.cpp)
- [Nth node from end of linked list [CPP]](Nth_node_from_end_of_linked_list.cpp)
- [Number of 1 Bits [CPP]](Number_of_1_Bits.cpp)
- [Page Faults in LRU [CPP]](Page_Faults_in_LRU.cpp)
- [Pairs with given sum in doubly linked list [CPP]](Pairs_with_given_sum_in_doubly_linked_list.cpp)
- [Palindrome String [CPP]](Palindrome_String.cpp)
- [Parenthesis Checker [CPP]](Parenthesis_Checker.cpp)
- [Populate Inorder Successor for all nodes [CPP]](Populate_Inorder_Successor_for_all_nodes.cpp)
- [Postorder of Tree Iterative-1 using Stack [CPP]](Postorder_of_Tree_Iterative-1_Stack.cpp)
- [Postorder of Tree Iterative-2 using Stack [CPP]](Postorder_of_Tree_Iterative-2_Stack.cpp)
- [Predecessor and Successor [CPP]](Predecessor_and_Successor.cpp)
- [Preorder of Tree Iterative [CPP]](Preorder_of_Tree_Iterative.cpp)
- [Preorder to Postorder [CPP]](Preorder_to_Postorder.cpp)
- [Print all k-sum paths in a binary tree [CPP]](Print_all_k-sum_paths_in_a_binary_tree.cpp)
- [Print nodes between two given levels of Binary Tree [CPP]](Print_nodes_between_two_given_levels_of_Binary_Tree.cpp)
- [Print nodes between two given levels of Binary Tree using Queue [CPP]](Print_nodes_between_two_given_levels_of_Binary_Tree_using_Queue.cpp)
- [Program for Shortest Job First [CPP]](Program_for_Shortest_Job_First.cpp)
- [Quick Sort on Linked List [CPP]](Quick_Sort_on_Linked_List.cpp)
- [Rearrange Characters [CPP]](Rearrange_characters.cpp)
- [Remove duplicate element from sorted Linked List [CPP]](Remove_duplicate_element_from_sorted_Linked_List.cpp)
- [Remove duplicates from an unsorted linked list [CPP]](Remove_duplicates_from_an_unsorted_linked_list.cpp)
- [Remove loop in Linked List [CPP]](Remove_loop_in_Linked_List.cpp)
- [Replace Element with Greatest Element on its Right [CPP]](Replace_Element_with_Greatest_Element_on_its_Right.cpp)
- [Reverse DLL in groups of a given size [CPP]](Reverse_DLL_in_groups_of_given_size.cpp)
- [Reverse Level Order Traversal [CPP]](Reverse_Level_Order_Traversal.cpp)
- [Reverse a Doubly Linked List [CPP]](Reverse_a_Doubly_Linked_List.cpp)
- [Reverse a Linked List in groups of given size [CPP]](Reverse_a_Linked_List_in_groups_of_given_size.cpp)
- [Reverse a String [CPP]](Reverse_a_String.cpp)
- [Reverse a linked list [CPP]](Reverse_a_linked_list.cpp)
- [Reverse a stack using recursion [CPP]](Reverse_a_stack-using_recursion.cpp)
- [Reverse a string using Stack [CPP]](Reverse_a_string_using_Stack.cpp)
- [Right View of Binary Tre [CPP]](Right_View_of_Binary_Tre.cpp)
- [Rotate Doubly linked list by N nodes [CPP]](Rotate_Doubly_linked_list_by_N_nodes.cpp)
- [Second Largest [CPP]](Second_largest.cpp)
- [Segregate even and odd nodes in a Link List [CPP]](Segregate_even_and_odd_nodes_in_a_Link_List.cpp)
- [Shop in Candy Store [CPP]](Shop_in_Candy_Store.cpp)
- [Smallest number [CPP]](Smallest_number.cpp)
- [Smallest subset with sum greater than all other elements [CPP]](Smallest_subset_with_sum_greater_than_all_other_elements.cpp)
- [Sort a K-sorted DLL [CPP]](Sort_a_K-sorted_DLL.cpp)
- [Sort a stack [CPP]](Sort_a_stack.cpp)
- [Sort an array of 0s 1s and 2s [CPP]](Sort_an_array_of_0s_1s_and_2s.cpp)
- [Sorted matrix [CPP]](Sorted_matrix.cpp)
- [Special Stack [CPP]](Special_Stack.cpp)
- [Spirally traversing a matrix [CPP]](Spirally_traversing_a_matrix.cpp)
- [Split a Circular Linked List into two halves [CPP]](Split_a_Circular_Linked_List_into_two_halves.cpp)
- [Stack using two queues [CPP]](Stack_using_two_queues.cpp)
- [Stack with operations on middle element [CPP]](Stack_with_operations_on_middle_element.cpp)
- [Steps by Knight [CPP]](Steps_by_Knight.cpp)
- [String is a valid shuffle of 2 strings or not [CPP]](String_is_a_valid_shuffle_of_2_strings_or_not.cpp)
- [String is shuffled substring of other string [CPP]](String_is_shuffled_substring_of_other_string.cpp)
- [Sum Tree [CPP]](Sum_Tree.cpp)
- [Sum of the Longest Bloodline of a Tree [CPP]](Sum_of_the_Longest_Bloodline_of_a_Tree.cpp)
- [Swap and Maximize [CPP]](Swap_and_Maximize.cpp)
- [The Celebrity Problem [CPP]](The_Celebrity_Problem.cpp)
- [Top View of Binary Tree [CPP]](Top_View_of_Binary_Tree.cpp)
- [Top View of a Binary Tree [CPP]](Top_View_of_a_Binary_Tree.cpp)
- [Topological Sort [CPP]](Topological_Sort.cpp)
- [Transform to Sum Tree [CPP]](Transform_to_Sum_Tree.cpp)
- [Triplet Sum in Array [CPP]](Triplet_Sum_in_Array.cpp)
- [Union of two arrays [CPP]](Union_of_two_arrays.cpp)
- [Union of two arrays [PYTHON]](Union_of_two_arrays.py)
- [Valid Substring [CPP]](Valid_Substring.cpp)
- [Value equal to Index value [CPP]](Value_equal_to_Index_value.cpp)
- [Zero Sum Subarrays [CPP]](Zero_Sum_Subarrays.cpp)
- [ZigZag Tree Traversal [CPP]](ZigZag_Tree_Traversal.cpp)