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

ความคิดเห็น • 1

  • @anisha_joshi15
    @anisha_joshi15  หลายเดือนก่อน

    class Solution {
    public:
    void segregate0and1(vector &arr) {
    int n=arr.size();
    int i=0;
    int j=n-1;
    while(i