Skip to content

Commit

Permalink
Merge pull request #36 from shynutpirate/master
Browse files Browse the repository at this point in the history
Solution for human traffic of stadium
  • Loading branch information
jayesh-kaza authored Oct 30, 2019
2 parents 85696eb + 0d5ef7b commit d2b9cb3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cpp/700_Search_in_BST.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* searchBST(TreeNode* root, int val) {
if (root == NULL)
return NULL;
if (root->val > val)
return searchBST(root->left,val);
else if (root->val < val)
return searchBST(root->right,val);
return root;
}
};
8 changes: 8 additions & 0 deletions sql/601_Human_Traffic_of_Stadium.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
select s1.* from stadium as s1, stadium as s2, stadium as s3
where ((s2.id = s1.id + 1 and s3.id =s1.id + 2)
or (s2.id = s1.id - 1 and s3.id = s1.id + 1)
or (s2.id = s1.id - 2 and s3.id = s1.id - 1))
and s1.people >= 100
and s2.people >= 100
and s3.people >= 100
Group by(s1.id);

0 comments on commit d2b9cb3

Please sign in to comment.