-
-
Notifications
You must be signed in to change notification settings - Fork 157
All easy gfg solution added #570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All easy gfg solution added #570
Conversation
Here's the code health analysis summary for commits Analysis Summary
|
hey @ajay-dhangar , please make it |
@Vipullakum007 I prefer quality over quantity. I don't need multiple files or folders . You can work on a single file that I assign, possibly at level 3, but ensure it is done professionally. Please make sure your content is clear, well-structured, and thoroughly explained. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now update code for all files based on suggestions
|
||
### Constraints | ||
- 1 ≤ N ≤ 10^5 | ||
- -10^3 ≤ arr[i] ≤ 10^3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace
- 1 ≤ N ≤ 10^5
- -10^3 ≤ arr[i] ≤ 10^3
to
- $1 ≤ N ≤ 10^5$
- $-10^3 ≤ arr[i] ≤ 10^3$
**Expected Auxiliary Space:** O(Number of distinct characters) | ||
|
||
### Constraints | ||
- 1 ≤ |str|,|patt| ≤ 10^5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace
- 1 ≤ |str|,|patt| ≤ 10^5
- 'a' ≤ str[i], patt[i] ≤ 'z'
to
- $1 ≤ |str|,|patt| ≤ 10^5$
- $'a' ≤ str[i], patt[i] ≤ 'z'$
|
||
### Complexity Analysis | ||
|
||
- **Time Complexity:** O(N), where N is the length of the string `str`. We iterate through each character in `patt` and use the `find` or `indexOf` method, which runs in O(N) time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace O(N)
to $O(N)$
and O(1)
to $O(1)$
|
||
You don't need to read input or print anything. Your task is to complete the function `bfsOfGraph()` which takes the integer `V` denoting the number of vertices and adjacency list as input parameters and returns a list containing the BFS traversal of the graph starting from the 0th vertex from left to right. | ||
|
||
**Expected Time Complexity:** O(V + E) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace O(V + E)
to $O(V + E)$
and O(V)
to $O(V)$
|
||
The provided solutions efficiently perform a Breadth First Search (BFS) traversal of a directed graph. By starting from the 0th vertex and using a queue to manage the traversal, the algorithms ensure that all reachable vertices are visited in the correct order. The solutions operate in O(V + E) time and use O(V) space complexity, where V and E are the numbers of vertices and edges in the graph, respectively. | ||
|
||
**Time Complexity:** O(V + E) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace
O(V + E)
$O(V + E)$
O(V)
$O(V)$
**Expected Auxiliary Space:** O(1) | ||
|
||
**Constraints** | ||
- 1 ≤ x ≤ 10^7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace 1 ≤ x ≤ 10^7
to $1 ≤ x ≤ 10^7$
|
||
You don't need to read input or print anything. The task is to complete the function `floorSqrt()` which takes `x` as the input parameter and returns its square root. Note: Try solving the question without using the sqrt function. The value of `x` ≥ 0. | ||
|
||
**Expected Time Complexity:** O(log N) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace O(log N)
to $O(log N)$
and O(1)
to $O(1)$
### Complexity Analysis | ||
|
||
- **Time Complexity:** O(N), where N is the number of nodes in the linked list. We traverse the entire list once. | ||
- **Space Complexity:** O(1), as we only use a constant amount of extra space for pointers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace O(1)
to $O(1)$
and O(N)
to $O(N)$
**Expected Auxiliary Space:** O(1) | ||
|
||
### Constraints | ||
1 ≤ N ≤ 10^4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad practice
### Constraints
1 ≤ N ≤ 10^4
Good practice
### Constraints
- $1 ≤ N ≤ 10^4$
### Your Task | ||
The task is to complete the function `reverseList()` with head reference as the only argument and should return the new head after reversing the list. | ||
|
||
**Expected Time Complexity:** O(N) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace O(N)
to $O(N)$
and O(1)
to $O(1)$
please can you point out what you want so that i can better / i can make professionally |
hey @ajay-dhangar , updated as per your suggestion , you can review it. please answer |
Yah sure, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update your code based on suggestions and can't be use space for maths expression. And review all files code and resolve issues
**Expected Auxiliary Space:** $O(V)$ | ||
|
||
**Constraints** | ||
- $ 1 ≤ V, E ≤ 10^4 $ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace - $ 1 ≤ V, E ≤ 10^4 $
to - $1 ≤ V, E ≤ 10^4$
dsa-solutions/gfg-solutions/Easy problems/check-for-balanced-tree.md
Outdated
Show resolved
Hide resolved
dsa-solutions/gfg-solutions/Easy problems/implement-two-stacks-in-an-array.md
Outdated
Show resolved
Hide resolved
|
hey @ajay-dhangar ,updated as per your suggestion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Related Issue
fixed : #386
Description
i have added solution for all easy problems
i have added 10 files for solution of 10 problems
Type of PR
Screenshots / Videos (if applicable)
Checklist
Additional Context
[Include any additional information or context that might be helpful for reviewers.]
Resources for Guidance
Here are some resources that may be helpful as you contribute to CodeHarborHub:
Resources for DSA Features on Our Site: