2023 AP Computer Science A FRQ

Поделиться
HTML-код
  • Опубликовано: 15 июл 2024
  • Write the findFreeBlock method, which searches period for the first block of free minutes that is duration minutes long. If such a block is found, findFreeBlock returns the first minute in the block. Otherwise, findFreeBlock returns -1. The findFreeBlock method uses the helper method isMinuteFree, which returns true if a particular minute is available to be included in a new appointment and returns false if the minute is unavailable.
    Consider the following list of unavailable and available minutes in period 2.
    The method call findFreeBlock(2, 15) would return 30 to indicate that a 15-minute block starting with minute 30 is available. No steps should be taken as a result of the call to findFreeBlock to mark those 15 minutes as unavailable.
    The method call findFreeBlock(2, 9) would also return 30. Whenever there are multiple blocks that satisfy the requirement, the earliest starting minute is returned.
    The method call findFreeBlock(2, 20) would return -1, since no 20-minute block of available minutes exists in period 2. Complete method findFreeBlock.
    You must use isMinuteFree appropriately in order to receive full credit.
    Intro: 00:00
    Pseudocode: 00:54
    Writing the code: 04:30
    Testing the first method call: 08:47
    Testing the second method call: 12:00
    Testing the third method call: 14:11

Комментарии • 2

  • @gavinwatson5759
    @gavinwatson5759 3 месяца назад

    Olga, I teach AP Computer Science A, and I'm impressed by your approach to solving FRQs in your videos - excellent work! As a seasoned programmer, I've gained valuable insights into teaching FRQs to students through watching your content. I just wanted to express my gratitude. Thank you!

    • @OlgaAndreevaVideos
      @OlgaAndreevaVideos  2 месяца назад

      Wow, thank you for this comment! It means a lot to me- happy to help out! :)