top of page
Search

Day 4 | Borze | C++

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

We are on a streak for the 4th question Today we are solving Borze: https://codeforces.com/contest/32/problem/B… Don't forget to give it a try yourself.


To solve this question I think like this - If we start from the first character, then if it is '.' then the first number cannot be anything other than 0 but if the first two characters are '-.' or '--' then it will be 1 or 2.


But if we have covered one number, then we can follow the same pattern for the rest of the string. For example - ". - . - -" Since the first character is '.', then the number here should be 0 similarly will be after "-." will be 1 and "--" be 2


You can write a simple loop for it (It's okay if the loop does not look that simple, it will be simple soon once you practice more questions) - https://codeforces.com/contest/32/submission/169338301


Today, I really tried a lot to not make any mistakes. Therefore I made two wrong attempts on these https://codeforces.com/contest/32/submission/169337884… and https://codeforces.com/contest/32/submission/169337809… But did you know that for compilation error or Wrong attempt of Test Case 1 is not counted towards penalty in Codeforces?


 
 
 

Comments


bottom of page