Skip to content

Instantly share code, notes, and snippets.

View theevo's full-sized avatar

Theo Vora theevo

  • Austin, TX
View GitHub Profile
/*:
# Tuesday Stretch Problem 6.2
## Add Ints
### Instructions:
Create a func called add where the method allows one to pass as many or as few Ints as desired and then adds them together and returns the result.
Example: If I call add(3, 7), it prints out 10. Example: If I call add(3, 7, 2, 4), it prints out 16. Example: If I call add(3, 7, 2, 9, 12, 11), it prints out 44.
*/
/*:
# Monday Stretch Problem 6.1
## Game of Threes
### Instructions:
1. Make a method that takes an Int and returns an array of steps to get to 1.
2. The game goes as follows: Start with the given Int and, if it is divisible by 3, divide it by 3, otherwise ADD OR SUBTRACT 1 (whichever makes the number divisible by 3, then divide it.
3. Repeat step 2, until you reach 1.
Example: Input: 100 Output: [100, 33, 11, 4, 1]
/*:
# Wednesday Stretch Problem 5.3
## Palindrome
### Instructions
- Make a function that takes in a string and returns if it is a palindrome (true/false).
```
palindrome("thanks") -> false
palindrome("rAcecar") -> true
```
- Then ignore spaces.
/*:
# Tuesday Stretch Problem 5.2
## Longest Word In String
### Instructions
- Write a function that takes a string and returns the biggest word in that string.
- Make sure to remove punctuation and whitespace.
```
longestWord("This string, has a gigantic! word in it...") // returns "gigantic"
longestWord("one, two, three") // returns "three"
/*:
# Monday Stretch Problem 5.1
## Hashtags
### Instructions - Hashtags
- Build a `Restaurant` model object with `name`, `streetAddress`, `city`, `state`, and `reviews` properties.
- Build a `Review` model object with a `username` and `text` property.
- Instantiate an array of `Restaurant` and `Review` objects. Make sure that each `Restaurant` object holds an array of reviews. Add hashtags to some of your reviews or restaruant descriptions. (Use Yelp or Google to help you come up with `Restaurants` and `Reviews`).
- Add a `hashtags` computed property to the `Restaurant` object that returns an array of any hashtags in the `Restaurant` or `Review`.
`- Check your computed property by printing a list of hashtags of each review and restaurant.
//: [Palindrome](@previous)
/*:
# Thursday Stretch Problem 5.4
## Greatest Common Divisor
### Instructions
- Read about recursion.
- Note Google's little joke when you search recursion in Chrome.
- Create a function that returns the greatest common divisor of two numbers using recursion. (function calling itself).
*/
//: [Palindrome](@previous)
/*:
# Thursday Stretch Problem 5.4
## Greatest Common Divisor
### Instructions
- Read about recursion.
- Note Google's little joke when you search recursion in Chrome.
- Create a function that returns the greatest common divisor of two numbers using recursion. (function calling itself).
*/
@theevo
theevo / FizzBuzz-ObjC.m
Created March 26, 2020 15:57
FizzBuzz in Objective-C
//
// main.m
// Stretch Problem 4.4 - FizzBuzz ObjC
//
// Created by theevo on 3/26/20.
// Copyright © 2020 Theo Vora. All rights reserved.
//
/*
Write a method that prints the numbers from 1 to an inputed number. But for multiples of three print "Dev" instead of the number and for the multiples of five print "Mtn". For numbers which are multiples of both three and five print "DevMtn".
*/
//
// main.m
// Stretch Problem 4.3 - HighestNumberInArray
//
// Created by theevo on 3/25/20.
// Copyright © 2020 Theo Vora. All rights reserved.
//
#import <Foundation/Foundation.h>