You have two bugs in your code
*for j in range(n-1, -1, -1):*
should be
*for j in range(n-1, 0, -1):*
This is to make sure that j-1 is not negative.
The other bug is for finding the right pair of CS to swap.
Use the following as example: CCSS
The first pair you swap is C*CS*S, then it
https://github.com/Sonu64/saving_the_universe_again/
Check out the code in my GitHub Repo please :)
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
Sorry for pasting all the code herebut though have a look..
def isCapable(s, able):
#finds if a beam is capable of withstanding "able"
charge = 1
damage = 0
for step in s:
if step == "S":
damage += charge
if step == "C":
charge *= 2
Can you share your code?
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit
Hello...Now I am swapping CS pairs from right to left, so that 6 CSSCS
ouputs 1 now. But though it Fails in the 2nd Test Set. What's the problem ?
I am really stuck at this ! :(
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To
Because you should consider flips from right to the left. Consider this
test case:
6 CSSCS
Your program outputs 2, should be 1.
On Mon, Apr 9, 2018 at 9:16 PM, aagontuk wrote:
> Hello, I have participated in the codejam for the first time. My solution
> for the problem
Hello, I have participated in the codejam for the first time. My solution for
the problem passed for test set 1 but failed for test set 2. But from the
analysis it seems correct to me. Why it failed? Here is my code -
https://gist.github.com/aagontuk/e5f4e7f30b2481d96a418882f8a2fa7e
I don't