You are not logged in. Please login at www.codechef.com to post your questions!

×

CHEFSIGN WA in some cases

Which test cases am I missing here? https://www.codechef.com/viewsolution/14592888 Thanks

PS: Please upvote the question so that I get proper reputation for upvoting other answers. Thank You.

asked 17 Jul '17, 23:14

frextrite's gravatar image

4★frextrite
133
accept rate: 0%

edited 18 Jul '17, 20:33


Here are some test cases

My output:
2
2
2
2
3
3
2
2
2
2

Your output:
2
2
1
1
3
1
2
2
2
2

link

answered 18 Jul '17, 01:45

liaojh's gravatar image

5★liaojh
1825
accept rate: 7%

edited 18 Jul '17, 01:56

Your int k has been left undefined in this case, which occasionally may equate to word.size() (especially if the last string has the same length as the current string) and terminate your loop early when the test case start with an '='. Set int k = 0; and you should pass the test cases.

(18 Jul '17, 02:03) liaojh5★

That was surely a really very silly mistake. Code is working perfectly now!

(18 Jul '17, 20:32) frextrite4★

If this helps , you have to count the longest consecutive subsequence of same characters (other than =)

link

answered 18 Jul '17, 01:01

trashmaster's gravatar image

2★trashmaster
98619
accept rate: 12%

Take a look at this solution may be this will help you Out Solution LINK

link

answered 17 Jul '17, 23:55

drjaat's gravatar image

2★drjaat
267112
accept rate: 6%

what if the test case is "<<<<" or ">>>>" your loop stops when u get another sign!! but what if u dont get any?

my solution!! https://www.codechef.com/viewsolution/14422984

hope this helped you

link

answered 17 Jul '17, 23:50

phantomhive's gravatar image

4★phantomhive
944
accept rate: 0%

edited 17 Jul '17, 23:51

Code is working fine on this test case. It's giving 5 as the output.

(17 Jul '17, 23:59) frextrite4★

His logic is almost correct. He is missing on very few edge cases, which i assume are repeated in those test cases.

(18 Jul '17, 00:01) vijju123 ♦♦4★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,070
×471
×42
×29
×22

question asked: 17 Jul '17, 23:14

question was seen: 398 times

last updated: 18 Jul '17, 20:33