Online-Judge | Online Judge for hosting coding competitions inside NIT | Learning library
kandi X-RAY | Online-Judge Summary
kandi X-RAY | Online-Judge Summary
Online Judge for hosting coding competitions inside NIT Durgapur made by GNU/Linux Users' Group!
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Online-Judge
Online-Judge Key Features
Online-Judge Examples and Code Snippets
Community Discussions
Trending Discussions on Online-Judge
QUESTION
I tried to solve this problem with BFS, but for input "99 100" my program uses more than 260 Mb and online-judge system throws MEMORY_LIMIT_EXCEEDED. I guess the problem is the way I use QUEUE. So what do you think is the problem? And how should I solve it?
Here is my code. And thanks in advance!:
...ANSWER
Answered 2018-Feb-08 at 09:55Your algorithm is not BFS, because, you can visit the same state more than one.
For example, 4 -> 3 -> 6 and 4 -> 8 -> 7 -> 6, which 6 will end up to be processed twice.
Secondly, for number x
that is greater than the target
, the minimum number of step is always
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Online-Judge
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page