{{ message }}

Instantly share code, notes, and snippets.

# Sakshi Sharma SakshiSharmaManshotra

Created May 8, 2021
View 136. Single Number.cpp
 class Solution { public: int singleNumber(vector& nums) { //O(nlogn) running time,O(1) space complexity sort(nums.begin(),nums.end()); int i; for(i=1;i
Created May 6, 2021
View 581. Shortest Unsorted Continuous Subarray.cpp
 class Solution { public: int findUnsortedSubarray(vector& nums) { /* O(nlogn) running time and O(n) extra space for auxilary vector where n is vectorsize */ vector aux;
Created Apr 15, 2021
View 98. Validate Binary Search Tree(inorder).cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 14, 2021
View 98. Validate Binary Search Tree.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 9, 2021
View 145. Binary Tree Postorder Traversal.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 9, 2021
View 144. Binary Tree Preorder Traversal.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 9, 2021
View 94. Binary Tree Inorder Traversal.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 9, 2021
View 111. Minimum Depth of Binary Tree.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 9, 2021
View 104. Maximum Depth of Binary Tree.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };
Created Apr 9, 2021
View 101. Symmetric Tree.cpp
 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * };