×

# [closed] Compilers and parsers

 0 Is the word prefix used as a subsequence beginning with "<" ? asked 04 May '14, 15:34 333●2●3●9 accept rate: 20% 3★kuruma 17.7k●72●143●209

### The question has been closed for the following reason "On going contest" by kuruma 04 May '14, 23:01

 1 It is not even clear what are you asking about :-( Did you see the second test case? answered 04 May '14, 15:40 16.9k●49●115●225 accept rate: 11% To understand longest prefix: <><<>><< The expected output is 4, right? <><><><><> Expected output is 2, right? <<> Expected output is 0, right? (04 May '14, 22:39) nnovoice2★ in the second example, why would you think that output is 2, a ditto example is there in the ques page (04 May '14, 23:48) gagaboy3★
 1 what is the meaning of length of the longest prefix.. what will be the output of test case ><><>>><><><><><> answered 04 May '14, 19:27 16●2 accept rate: 0% input : ><><>>><><><><><> output : 0 (04 May '14, 20:08) 0 because a valid input should always '<' as first character (07 May '14, 19:04) luduvigo3★
 0 I won't answer such questions here because: They are not directly related to the problem itself (instead they are related to string concepts that are easily googlable); More than 1000 people solved it already, so, you can possibly do it too; Bruno answered 04 May '14, 23:01 3★kuruma 17.7k●72●143●209 accept rate: 8% 3 it's funny how most of the problems define trivial things such as the euclidean distance or the definition of permutation but the problem writer and you refuse to give a definition of prefix. (05 May '14, 08:54) vicfred3★ 2 To be honest, I hadn't phrased the problem like that (it was the tester who changed it to be like that and I agreed with it because it is crystal clear). You can see what a prefix is here: http://en.wikipedia.org/wiki/Prefix_%28computer_science%29#Prefix I can add this to the problem page if needed... (05 May '14, 14:37) kuruma3★ what will be output for this <>>><> (05 May '14, 15:39) 1 I guess 2 (not solved the problem yet). A better test case would be: <>>><<>> right? (05 May '14, 17:35) nnovoice2★ Solved it finally, but I will refrain from posting the outputs now :-) (05 May '14, 18:14) nnovoice2★ Is the output to string "<" is 1 and "<<>" is 3 (05 May '14, 20:47) ...only if you skip the part for an expression to be valid, a "<" symbol must always have a corresponding ">" from the statement, read carefully! (05 May '14, 22:21) output of this <>>><<>> is 4 (07 May '14, 14:54) why is it 4? I guess we should look for 'longest prefix of each of these expressions that is valid' (07 May '14, 17:47) nnovoice2★ @anmolgarg27 output is 2 better testcase would be <><<><>><><<<>>>>><> (07 May '14, 18:41) STOP discussing test cases during the contest!!! (07 May '14, 18:49) showing 5 of 11 show all

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×99
×6

question asked: 04 May '14, 15:34

question was seen: 2,017 times

last updated: 07 May '14, 19:04