diff --git a/Competitive/README.md b/Competitive/README.md index 24dc617..6a4e658 100644 --- a/Competitive/README.md +++ b/Competitive/README.md @@ -13,4 +13,61 @@ You need to create a pull with YourName.extension in the respective solutions fo Ex- If you are solving Problem no 0, your name is abhishek and you are solving it in C++, -Create a pull in the solutions folder of problem 0 with your solution in a file named Abhishek.cpp \ No newline at end of file +Create a pull in the solutions folder of problem 0 with your solution in a file named Abhishek.cpp + + + +## Question 0: Understand the pattern and write the code accordingly. + + #size 3 + + ----c---- + --c-b-c-- + c-b-a-b-c + --c-b-c-- + ----c---- + + #size 5 + + --------e-------- + ------e-d-e------ + ----e-d-c-d-e---- + --e-d-c-b-c-d-e-- + e-d-c-b-a-b-c-d-e + --e-d-c-b-c-d-e-- + ----e-d-c-d-e---- + ------e-d-e------ + --------e-------- + + +## Question 1: Write a function to check if a linked list has a loop. + + * The function accepts start of the linked list. + * The function returns corresponding boolean value. + + +## Question 2: Write a function to check if the parentheses in an expression is balanced or not. [Using Stack]. + + Input: exp = “[()]{}{[()()]()}” + Output: Balanced + + Input: exp = “[(])” + Output: Not Balanced + +## Question 3: Write a function which takes n as input and returns the corresponding nth fibonacci number. + NOTE: You have to use recursion. + You have to make sure program works even for 100th fibonacci number. + +## Question 4: Write a function to find the sum of all the leaf node of a binary tree, you are given root of the tree. + 10 + / \ + 20 30 + / / \ + 40 50 60 + + Result : 40 + 50 + 60 = 150. + + + +For any doubt contact : Anubhav (anubhavraj.08@gmail.com) (9521419475) +