Modify the Array Practice GFG POTD (24 OCTOBER 2024)

Поделиться
HTML-код
  • Опубликовано: 30 ноя 2024
  • ⭐ IN THE GIVEN PROBLEM , WE NEED TO PERFORM THE FOLLOWING:
    ⭐FIRST WE NEED TO CHECK IF THE CURRENT VALUE IS EQUAL TO NEXT ELEMENT OR NOT. IF EQUAL , DOUBLE THE CURRENT NUMBER, AND MAKE NEXT NUMEBR AS 0.
    ⭐AFTER PERFORMING ABOVE WE GET A ARRAY , WE NEED TO MODIFIED , IN SUCH A WAY , ALL THE VALUES APPEARS FIRST EXCEPT ZERO , BY SWAPPING THE NUMBER.
    ⭐TIME COMPLEXITY: O(n)
    ⭐SPACE COMPLEXITY: O(1)

Комментарии •