Segregate 0s and 1s || GFG POTD today || easy || 14 july
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- time complexity : O(n) [use of a loop]
space complexity : O(1) [no extra data structure]
** check comments for solution
:
:
#dailychallenge #gfg #coding #gfgpotd #programming #gfg #gfgpractice
class Solution {
public:
void segregate0and1(vector &arr) {
int n=arr.size();
int i=0;
int j=n-1;
while(i