Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
256 views

Dynamic programming solution for cross river algorithm (part 2)

I'm working on the cross river problem (previous post here). Any advice on performance improvement in terms of algorithm time complexity, code bugs or code style advice is appreciated. More ...
Lin Ma's user avatar
  • 3,543
5 votes
1 answer
1k views

Dynamic programming solution for cross river algorithm

Working on below cross river problem, and post my code in Python 2.7 using dynamic programming. Any advice on performance improvement in terms of algorithm time complexity, code bugs or code style ...
Lin Ma's user avatar
  • 3,543
4 votes
1 answer
1k views

Guess number with lower or higher hints

Problem statement Two players - Alice and Bob. Alice needs to guess a number \$n\$, from range \$[1, N]\$, \$N \le 200\$ In \$i\$th turn, Alice guesses a number \$i\$ Bob chooses to ...
Lin Ma's user avatar
  • 3,543
5 votes
1 answer
447 views

Different path for grid move

Given a m * n grids, and one is allowed to move up or right, find the different number of paths between two grid points. My major idea is, if move r steps right, <...
Lin Ma's user avatar
  • 3,543
5 votes
2 answers
1k views

High execution time of LCS length program in Python2

I was trying to solve the Longest Common Subsequence problem on a HackerRank exercise. It's quite simple and straightforward, just print out the length of the LCS. I submitted this code: ...
Sidharth Samant's user avatar