Here a new problem solved by me!
Here the problem statement:
Fox Ciel is playing the popular game ‘Cut the Rope’ on her smartphone. The game has multiple stages, and for each stage the player can gain between 0 and 3 stars, inclusive. You are given a string[] result containing Fox Ciel’s current results: For each stage, result contains an element that specifies Ciel’s result in that stage. More precisely, result[i] will be “—” if she got 0 stars in stage i, “o–” if she got 1 star, “oo-” if she got 2 stars and “ooo” if she managed to get all 3 stars. Return the total number of stars Ciel has at the moment.
Here the constraints:
result will contain between 1 and 50 elements, inclusive.
Each element in result will be one of “—”, “o–”, “oo-”, “ooo”.
Here my approach:
I decided to use two for loops, the first one to read each element, and then another for loop to read each single element inside that, and adding 1 foreach “o” in the loops.
Here my code:
public class FoxAndGame
{
public int countStars(string[] result)
{
int res = 0;
for (int i = 0; i < result.Length; i++)
{
for (int a = 0; a < result[i].Length; a++)
{
if (result[i][a].ToString() == "o")
res++;
}
}
return res;
}
}
If you have another approach, please share with me in a comment!
Thank you very much

any idea about 3rd problem ?
1000 problem? No, i´m so sorry.. i had no time.. in fact, my 500 failed system test!
ohh !!
if you want, invite me to gmail chat, and we will be in touch!
oscarbralo@gmail.com!
sure