Ры (pbl) wrote,
Ры
pbl

а вот еще хорошая простенькая задачка из comp.programming:
Given an array of integers which is unsorted, other than the first number being even and the last one odd, find a pair of numbers so that array[i] is even and array[i+1] is odd and return the i. this must be done at log(n) complexity.
--некий студень in <c557b5bd-43a2-4935-86e8-51c2f5d9b01b@t35g2000yqj.googlegroups.com>

требуемая сложность - больша-ая подсказка, как обычно. в результате решается за секунды. жалко, припозднилась задачка.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments