Skip to content

Commit

Permalink
Merge pull request #59 from bastenahamad/main
Browse files Browse the repository at this point in the history
Added Solution of POTD of July 1
  • Loading branch information
Ayu-hack authored Oct 8, 2024
2 parents aa15193 + 9f1bd65 commit 1da2ca5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions July 2024/01_July_POTD.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution {
public:
TreeNode *rec(vector<int>&ar, int i) {
if(i >= ar.size()) return NULL;
TreeNode *root = new TreeNode(ar[i]);
root->left = rec(ar, 2*i+1);
root->right = rec(ar, 2*i+2);
return root;
}
void convert(Node *head, TreeNode *&root) {
Node *temp = head;
vector<int>cur;
while(temp != NULL) {
cur.push_back(temp->data);
temp = temp->next;
}
root = rec(cur, 0);
}
};
2 changes: 1 addition & 1 deletion July 2024/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
### Please add solutions of July 2024
### Please Add POTDs of GFG JULY Month

0 comments on commit 1da2ca5

Please sign in to comment.