Day 9 | Stones on Table | C++
- 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
![Day 44 | Binary Search Practice [Leetcode] | C++](https://static.wixstatic.com/media/fbea2a_167f1b66234f4d30b91bcf5b517f83f3~mv2.jpg/v1/fill/w_980,h_490,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/fbea2a_167f1b66234f4d30b91bcf5b517f83f3~mv2.jpg)
![Day 43 | Graph and Tree Practice [Leetcode] II | C++](https://static.wixstatic.com/media/fbea2a_361d6f7cd90c431b9f25518e1503da94~mv2.jpg/v1/fill/w_980,h_490,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/fbea2a_361d6f7cd90c431b9f25518e1503da94~mv2.jpg)
![Day 42 | Graph Practice [LeetCode] | C++](https://static.wixstatic.com/media/fbea2a_6570bb28577149f19db06704d542789a~mv2.jpg/v1/fill/w_980,h_490,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/fbea2a_6570bb28577149f19db06704d542789a~mv2.jpg)
Comments