This problem needs a test suite
Yes, Ujjwal: you must define well the test cases.
I added two simple tests.
284 Solvers
966 Solvers
299 Solvers
250 Solvers
377 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!