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


help needed in leetcode problem

I am trying to do this question on leetcode. Can someone please tell me what is wrong with my code. It is giving correct answer on codeblocks for the testcase which is failing on leetcode platform . However the same test case is giving correct answer when I run it as custom input on leetcode. Any suggestions:) Thanks in advance. Please help.

asked 03 Apr '18, 14:02

pavitra_ag's gravatar image

accept rate: 5%

edited 03 Apr '18, 17:02

while(v[i].second==s) { t.push_back(v[i].first); i++; }

add the condition (i < n) inside the while loop and then try.

edit : [ ["ate", "eat","tea"], ["nat","tan"], ["bat"] ]

I think that the output format is this i.e. you have to insert brackets also. Not sure about this! btw is there a way to know how many tests are passed? If yes and your code didn't pass a single test than try to format it that way and try!

Let me know if it doesn't works.


answered 03 Apr '18, 19:06

pk301's gravatar image

accept rate: 16%

edited 04 Apr '18, 07:42

no success

(03 Apr '18, 20:14) pavitra_ag4★

i've updated my answer please look into it and feel free to contact if doesn't work :)

(04 Apr '18, 07:42) pk3012★
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 03 Apr '18, 14:02

question was seen: 188 times

last updated: 04 Apr '18, 07:42