BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
URL:https://www.learndesk.us/class/6534923311644672/lesson/f8ef1eadeafb62312623dd9fb1f0166f?ref=outlook-calendar
SUMMARY:Homework Solution
DTSTART;TZID=America/Los_Angeles:20260502T190000
DTEND;TZID=America/Los_Angeles:20260502T200000
LOCATION:https://www.learndesk.us/class/6534923311644672/lesson/f8ef1eadeafb62312623dd9fb1f0166f?ref=outlook-calendar
DESCRIPTION: * Homework1 Solution

- Write the same function isOdd that takes a natural number and returns true if the number is odd, but using recursion and without using the modulo (%) operator.

print(isOdd(4)) // will print false
print(isOdd(41)) // will print true
print(isOdd(0)) // will print false

Use Base Cases:

isOdd(0) = false
isOdd(1) = true

- Observation:
isOdd(0) = isOdd(2) = isOdd(4) = .... = false
isOdd(1) = isOdd(3) = isOdd(5) = .... = true

func isOdd(_ n: Int) -> Bool {
       if n == 0 {
           return false    // 1st BASE CASE
       } else if n == 1 {
       	   return true	// 2nd BASE CASE 
       } else {
       	   return isOdd(n - 2)	// RECRUSIVE CASE
       }
}

- or using conditional expression (shorthand):

- Remeber the syntax: CONDITION ? TRUE_CASE : FALSE_CASE
- Just like if/else statement, it can be chained together:

func isOdd(_ n: Int) -> Bool { return n == 0 ? false : (n == 1 ? true :  isOdd(n - 2)) }


* Homework2 Solution:

  - Write a function...

https://www.learndesk.us/class/6534923311644672/lesson/f8ef1eadeafb62312623dd9fb1f0166f?ref=outlook-calendar
STATUS:CONFIRMED
SEQUENCE:3
BEGIN:VALARM
TRIGGER:-PT10M
DESCRIPTION:Class Reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR