Though this code passed all tests,yet I feel it has lots of loopholes. Please check it and tell me where it has loopholes. Please suggest me alternative way to solve this question with minimum steps https://code.sololearn.com/cNElp5Lxj2mQ/?ref=app
3/20/2022 6:26:58 AM
Md Saif ali11 Answers
New AnswerOf course, but faster and easier will be the idea as here in the solution with Python as follows: t = input().replace("x", "") print("ALARM" if "$T" in t or "T$" in t else "quiet")
Md Saif ali did you find realization of the above mentioned Python code in Java? If you want you can see that here: https://code.sololearn.com/cIj81srYpWeb/?ref=app
trim() is good thought, but not so really effective. If you remove additional all x from input it would be better. Then you can test the location of neighbors.
JaScript Can we create a String which store only g,t,m . And we then we will find index of m then we will run loop which will check 't' [both at a+i ,a-i ...where "a" is index of m]won't appear before g?
Md Saif ali I left that to you, the research, how can it be written in Java. A solution approach or idea is in my opinion the most important. The implementation is then fun.
FlowerNarges I didn't find the line or code segment about which you are talking about.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message