English 字幕

← Different Approach - Intro to Computer Science


Showing Revision 6 created 05/24/2016 by Udacity Robot.

  1. So let's think of a really simple way we might solve this problem. And what I'm
  2. going to suggest is a little like how we started. We're going to start on the
  3. day of the first date, and we're going to just count the days, we're going to go
  4. one day at a time. We're not going to do anything special when we go through
  5. months, we're just going to keep counting days, keep adding as we go. And we're
  6. going to keep doing this until we get to our target date, and I got 156. So
  7. here's our pseudo code for, a really simple, brain dead way of doing it. We
  8. initialize dates to 0. We have a loop that keeps going as long as date 1 is
  9. before date 2 and each step we advance, date 1 to the next day, and we add 1 to
  10. the number of days.