Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. def safe_pawn_count(pawns[n]) #pawns[n] = list of pawns, there are n pawns
  2. lowest_index = ∞
  3. lowest_count = 0
  4. for each pawn in pawns
  5. if pawn.row_index < lowest_index
  6. lowest_index = pawn.index
  7. lowest_count = 1
  8. else if pawn.row_index = lowest_index
  9. lowest_count = lowest_count + 1
  10. return n - lowest_count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement