Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. /*
  2. Given an array of integers greater than zero, find if it is possible to
  3. split it in two (without reordering the elements), such that the sum
  4. of the two resulting arrays is the same. Print the resulting arrays.
  5. */
  6.  
  7. /*
  8. # In [1]: can_partition([5, 2, 3])
  9. # ([5], [2, 3])
  10. # Out[1]: True
  11. #
  12. # In [2]: can_partition([2, 3, 2, 1, 1, 1, 2, 1, 1])
  13. # ([2, 3, 2], [1, 1, 1, 2, 1, 1])
  14. # Out[2]: True
  15. #
  16. # In [3]: can_partition([1, 1, 3])
  17. # Out[3]: False
  18. #
  19. # In [4]: can_partition([1, 1, 3, 1])
  20. # Out[4]: False
  21. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement