top of page
Search

Day 9 | Stones on Table | C++

  • Writer: Ayush Mahajan
    Ayush Mahajan
  • Aug 28, 2022
  • 1 min read

Day 9, Our last single-digit day Today we will be solving Stones on Table: https://codeforces.com/contest/266/problem/A… Do try it yourself first.


I overcomplicated when I tried it for the first time. I went against the advice I gave yesterday - First understand the question properly before coding. I made some errors because of this, got WA on TC 3. But then followed the same steps and got AC.


If two adjacent characters are similar then we need to remove one of them, and it doesn't matter which one we remove, we just need to remove it. So we can simply check if a character is the same as the previous one, we remove it, or else we add it.


You can find my implementation here: https://codeforces.com/contest/266/submission/169769233

 
 
 

Comments


bottom of page