Skip to content

Commit 6639631

Browse files
committed
updated as per your sugeestion
1 parent afcfbff commit 6639631

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

dsa-solutions/gfg-solutions/0023-Find-triplet-with-zero-sum.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ You don't need to read input or print anything. Your task is to complete the fun
5555
**Expected Auxiliary Space:** O(1)
5656

5757
### Constraints
58-
- 1 ≤ N ≤ 10^5
59-
- -10^3 ≤ arr[i] ≤ 10^3
58+
59+
- $1 ≤ N ≤ 10^5$
60+
- $-10^3 ≤ arr[i] ≤ 10^3$
6061

6162
## Solution
6263

dsa-solutions/gfg-solutions/0024-minimum-indexed-character.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ There are no characters that are common in "patt" and "str".
5050
### Your Task
5151
You only need to complete the function `minIndexChar()` that returns the index of the answer in `str` or returns `-1` if no character of `patt` is present in `str`.
5252

53-
**Expected Time Complexity:** O(N)
54-
**Expected Auxiliary Space:** O(Number of distinct characters)
53+
**Expected Time Complexity:** $O(N)$
54+
**Expected Auxiliary Space:** $O(Number of distinct characters)$
5555

5656
### Constraints
57-
- 1 ≤ |str|,|patt| ≤ 10^5
58-
- 'a' ≤ str[i], patt[i] ≤ 'z'
57+
58+
- $1 ≤ |str|,|patt| ≤ 10^5$
59+
- $'a' ≤ str[i], patt[i] ≤ 'z'$
5960

6061
## Solution
6162

@@ -169,8 +170,8 @@ class Solution {
169170

170171
### Complexity Analysis
171172

172-
- **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.
173-
- **Space Complexity:** O(1), as we only use a constant amount of extra space for variables.
173+
- **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.
174+
- **Space Complexity:** $O(1)$, as we only use a constant amount of extra space for variables.
174175

175176
---
176177

dsa-solutions/gfg-solutions/Easy problems/bfs-of-graph.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Starting from 0, it will go to 1 then 2, thus BFS will be 0 1 2.
4444

4545
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.
4646

47-
**Expected Time Complexity:** O(V + E)
48-
**Expected Auxiliary Space:** O(V)
47+
**Expected Time Complexity:** $ O(V + E) $
48+
**Expected Auxiliary Space:** $O(V)$
4949

5050
**Constraints**
51-
- 1 ≤ V, E ≤ 10^4
51+
- $ 1 ≤ V, E ≤ 10^4 $
5252

5353
## Solution
5454

@@ -213,8 +213,8 @@ class Solution {
213213

214214
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.
215215

216-
**Time Complexity:** O(V + E)
217-
**Auxiliary Space:** O(V)
216+
**Time Complexity:** $ O(V + E) $
217+
**Auxiliary Space:** $ O(V)$
218218

219219
## References
220220

dsa-solutions/gfg-solutions/Easy problems/reverse-a-doubly-linked-list.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ After reversing the list, elements are 196 <--> 59 <--> 122 <--> 75.
4545
### Your Task
4646
Your task is to complete the given function `reverseDLL()`, which takes head reference as an argument and reverses the elements in-place such that the tail becomes the new head and all pointers are pointing in the right order. You need to return the new head of the reversed list.
4747

48-
**Expected Time Complexity:** O(N)
49-
**Expected Auxiliary Space:** O(1)
48+
**Expected Time Complexity:** $ O(N)$
49+
**Expected Auxiliary Space:** $O(1)$
5050

5151
### Constraints
52-
1 ≤ number of nodes ≤ 10^4
53-
0 ≤ value of nodes ≤ 10^4
52+
- $ 1 ≤ number of nodes ≤ 10^4 $
53+
- $ 0 ≤ value of nodes ≤ 10^4 $
5454

5555
## Solution
5656

@@ -155,8 +155,8 @@ class Solution {
155155

156156
### Complexity Analysis
157157

158-
- **Time Complexity:** O(N), where N is the number of elements in the doubly linked list. We traverse the entire list once.
159-
- **Space Complexity:** O(1), as we only use a constant amount of extra space for pointers.
158+
- **Time Complexity:** $ O(N),$ where N is the number of elements in the doubly linked list. We traverse the entire list once.
159+
- **Space Complexity:** $O(1)$, as we only use a constant amount of extra space for pointers.
160160

161161
---
162162

dsa-solutions/gfg-solutions/Easy problems/reverse-a-linked-list.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ After reversing the list, elements are 10->9->8->7->2.
4545
### Your Task
4646
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.
4747

48-
**Expected Time Complexity:** O(N)
49-
**Expected Auxiliary Space:** O(1)
48+
**Expected Time Complexity:** $ O(N) $
49+
**Expected Auxiliary Space:** $ O(1) $
5050

5151
### Constraints
52-
1 ≤ N ≤ 10^4
52+
- $ 1 ≤ N ≤ 10^4 $
5353

5454
## Solution
5555

@@ -178,8 +178,8 @@ function reverseList(head: ListNode | null): ListNode | null {
178178

179179
### Complexity Analysis
180180

181-
- **Time Complexity:** O(N), where N is the number of nodes in the linked list. We traverse the entire list once.
182-
- **Space Complexity:** O(1), as we only use a constant amount of extra space for pointers.
181+
- **Time Complexity:** $ O(N) $, where N is the number of nodes in the linked list. We traverse the entire list once.
182+
- **Space Complexity:** $ O(1) $, as we only use a constant amount of extra space for pointers.
183183

184184
---
185185

dsa-solutions/gfg-solutions/Easy problems/square-root.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ Explanation: Since 4 is a perfect square, its square root is 2.
3939

4040
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.
4141

42-
**Expected Time Complexity:** O(log N)
43-
**Expected Auxiliary Space:** O(1)
42+
**Expected Time Complexity:** $ O(log N) $
43+
**Expected Auxiliary Space:** $ O(1) $
4444

4545
**Constraints**
46-
- 1 ≤ x ≤ 10^7
46+
- $ 1 ≤ x ≤ 10^7 $
4747

4848
## Solution
4949

@@ -187,10 +187,10 @@ class Solution {
187187

188188
## Complexity Analysis
189189

190-
The provided solutions efficiently find the floor value of the square root of a given integer `x` using binary search. This approach ensures a time complexity of O(log N) and an auxiliary space complexity of O(1). The algorithms are designed to handle large values of `x` up to 10^7 efficiently without relying on built-in square root functions.
190+
The provided solutions efficiently find the floor value of the square root of a given integer `x` using binary search. This approach ensures a time complexity of $ O(log N) and an auxiliary space complexity of $ O(1) $. The algorithms are designed to handle large values of `x` up to 10^7 efficiently without relying on built-in square root functions.
191191

192-
**Time Complexity:** O(log N)
193-
**Auxiliary Space:** O(1)
192+
**Time Complexity:** $ O(log N) $
193+
**Auxiliary Space:** $ O(1) $
194194

195195
---
196196

0 commit comments

Comments
 (0)