diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d79841e Binary files /dev/null and b/.DS_Store differ diff --git a/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift b/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift index 13cc14e..de72e14 100644 --- a/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift +++ b/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift @@ -11,16 +11,269 @@ Work on your solutions here. Link: https://docs.google.com/document/d/1INvOynuggw69yLRNg3y-TPwBiYb3lQZQiFUOxZKBwsY/edit#heading=h.za36ai6n5fth -1) +*/ +// 1) Given a partially filled in Sudoku board and a set of coordinates in that board pointing to an empty square, write a function that returns a list containing all numbers that the empty square could be. -2) +func getValidNumbersCameron(sudokuBoard:[[Int?]], row:Int, col:Int) -> [Int] { + var valid: Set = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + for c in 0..(valid) +} -3) +func getAllColArrayIndexRefactored(paramCol: Int, board: [[Int]]) -> [String: [Int]] { + // grab all the index Array that are associated with col + let col = paramCol-1 + var xArray = [Int]() + let numberOfColBox = Int(sqrt(Double(board.count))) + var xNumber = (col)/numberOfColBox + for _ in 0.. [String: [Int]] { + // grab all the index Array that are associated with row + let row = paramRow - 1 + var yArray = [Int]() + let numberOfRowBox = Int(sqrt(Double(board.count))) + var yNumber = row / numberOfRowBox + + for _ in 0.. [String: [Int]] { + // grab all the index Array that are associated with col + let col = paramCol-1 + var xArray = [Int]() + var xNumber = (col)/3 + xArray.append(xNumber) + xNumber += 3 + xArray.append(xNumber) + xNumber += 3 + xArray.append(xNumber) + var xArrayAtIndex = [Int]() + if (col % 3 == 0) { + xArrayAtIndex.appendContentsOf([0,3,6]) + } else if (col % 3 == 1) { + xArrayAtIndex.appendContentsOf([1,4,7]) + } else { + xArrayAtIndex.appendContentsOf([2,5,8]) + } + + return ["sudokuSmallBox": xArray, "indexNumber":xArrayAtIndex] +} + +func getAllRowArrayIndex(paramRow: Int) -> [String: [Int]] { + // grab all the index Array that are associated with row + let row = paramRow - 1 + var yArray = [Int]() + var yNumber = (row)/3 + yArray.append(yNumber) + yNumber += 1 + yArray.append(yNumber) + yNumber += 1 + yArray.append(yNumber) + + // grall all the index number that are row Array + var yArrayAtIndex = [Int]() + if(row % 3 == 0){ + yArrayAtIndex.appendContentsOf([0,1,2]) + } else if (row % 3 == 1) { + yArrayAtIndex.appendContentsOf([3,4,5]) + } else { + yArrayAtIndex.appendContentsOf([6,7,8]) + } + + return ["sudokuSmallBox":yArray, "indexNumber":yArrayAtIndex] +} + +func getValidNumbers(sudokuBoard: [[Int]], row: Int, col: Int) -> Set{ + let colDictionary = getAllColArrayIndexRefactored(col, board: sudokuBoard) +// let rowDictionary = getAllRowArrayIndexRefactored(row, board: sudokuBoard) +// let colDictionary = getAllColArrayIndex(col) + + let rowDictionary = getAllRowArrayIndex(row) + + var colValue = [Int]() + for i in colDictionary["sudokuSmallBox"]! { + for j in colDictionary["indexNumber"]! { + colValue.append(sudokuBoard[i][j]) + } + } + + var rowValue = [Int]() + for i in rowDictionary["sudokuSmallBox"]! { + for j in rowDictionary["indexNumber"]! { + rowValue.append(sudokuBoard[i][j]) + } + } + + let combinedRowColValue = Set(colValue).union(Set(rowValue)) + let completeNumber = Set([0,1,2,3,4,5,6,7,8,9]) + + return completeNumber.subtract(combinedRowColValue) +} + +let sampleInput = [[5,0,8,9,0,0,0,0,0], + [0,7,3,6,0,0,9,0,8], + [1,9,0,4,0,8,0,3,5], + [0,7,0,0,0,2,0,1,0], + [0,0,0,0,0,0,0,0,0], + [0,6,0,9,0,0,0,8,0], + [1,9,0,2,0,3,0,8,7], + [3,0,6,0,0,7,1,9,0], + [0,0,0,0,0,9,3,0,4]] + +let sampleInputCameron: [[Int?]] = [[5,0,8,9,0,0,0,0,0], + [0,7,3,6,0,0,9,0,8], + [1,9,0,4,0,8,0,3,5], + [0,7,0,0,0,2,0,1,0], + [0,0,0,0,0,0,0,0,0], + [0,6,0,9,0,0,0,8,0], + [1,9,0,2,0,3,0,8,7], + [3,0,6,0,0,7,1,9,0], + [0,0,0,0,0,9,3,0,4]] + +getValidNumbers(sampleInput, row: 4, col: 4) +getValidNumbersCameron(sampleInputCameron, row: 4, col: 4) + + +// 2) rotate a matrix by ninety degrees +// Input: matrix:[[Int]] +// Output: matrix: [[Int]] +// +// Sample Input: [[1,2,3,4], +// [5,6,7,8], +// [9,0,1,2], +// [3,4,5,6]] +// +// Sample Output: [[3,9,5,1], +// [4,0,6,2], +// [5,1,7,3], +// [6,2,8,4]] + +func rotateMatrixNinetyDegree(matrix: [[Int]]) -> [[Int]] { + var rotatedMatrix = [[Int]]() + for i in 0.. [Int] { + var left = value[0...1] + if left[0] > left [1] { + let t = left[0] + left[0] = left[1] + left[1] = t + } + + var right = value[2...4] + if right[0] > right [1] { + let t = right[1] + right[0] = right[1] + right[1] = t + } + // 1 3 + // 2 4 + + return[] +} -*/ diff --git a/HWFrom1-24(Recursion).playground/Contents.swift b/HWFrom1-24(Recursion).playground/Contents.swift index 1c44504..d341065 100644 --- a/HWFrom1-24(Recursion).playground/Contents.swift +++ b/HWFrom1-24(Recursion).playground/Contents.swift @@ -1,3 +1,5 @@ +import Foundation + /* @@ -10,16 +12,47 @@ Homework link: https://docs.google.com/document/d/1INvOynuggw69yLRNg3y-TPwBiYb3l //Question 1 +func fib(firstNumber: Int, secondNumber: Int, n: Int) -> Int { + var previousNumber1 = firstNumber + var previousNumber2 = secondNumber + var nth = 0 + for _ in 0.. Int { + let stepCount = Int(arc4random_uniform(3)) - 1 + stepNum += stepCount; + switch(stepCount) { + case -1: print("Ouch \(stepNum)") + case 1: print("Yay \(stepNum)") + default: print("Beep \(stepNum)") + } + return stepCount +} + +func stepUp() { + let didTryStep = tryStep() + if didTryStep == 0 { + stepUp() + } else if didTryStep == -1 { + stepUp() + stepUp() + } +} + +stepUp() + +//Question 3 - - -//Question 3 \ No newline at end of file diff --git a/HWfrom1-09-16(SwiftIntro).playground/Contents.swift b/HWfrom1-09-16(SwiftIntro).playground/Contents.swift index 488e9ed..67d9256 100644 --- a/HWfrom1-09-16(SwiftIntro).playground/Contents.swift +++ b/HWfrom1-09-16(SwiftIntro).playground/Contents.swift @@ -10,14 +10,78 @@ Use the link here to get the questions. Then code your solutions below. If it https://docs.google.com/document/d/1DQ2aCJ_yUZtazzCfb0PaS81bg61V2ZOSxpABh981xSo/edit +*/ -1) - -2) +// 1) Given an integer N, there is a list of size N-1 that is missing one number from 1 - N(inclusive). Find that number. +func findTheMissingNumberFromAnArray(numberList:[Int], totalN: Int) -> Int { + var totalSumOfAnArray = 0 + var totalSumOfNonMissingArray = 0 + + for i in 1...totalN { + totalSumOfNonMissingArray += i + } + for i in 1...numberList.count { + totalSumOfAnArray += i + } + + return totalSumOfNonMissingArray - totalSumOfAnArray +} -3) +// 3)Given two lists, find the smallest value that exists in both lists. +// L1 = [1,2,5,9] +// L2 = [9, 20 , 5] +func smallestValueFromTwoArray(list1: [Int], list2: [Int]) -> Int { + let sortedList1 = list1.sort({$0 < $1}) + let sortedList2 = list2.sort({$0 < $1}) + if sortedList1.first > sortedList2.first { + return sortedList2.first! + } else { + return sortedList1.first! + } +} -4) +// 4) Check to see if an integer is a palindrome don’t use casting +func isIntegerPalindrome(number: Int) -> Bool { + var digits = 1 + var tens = 10 + while (number / tens > 0) { + digits += 1 + tens *= 10 + } + + var moduleOfTen = 10 + for i in 0...digits { + var prevBackEndNumber : Int? + var backEndNum = 0 + if (prevBackEndNumber != nil) { + backEndNum = number % moduleOfTen + backEndNum -= prevBackEndNumber! + } else { + backEndNum = number % moduleOfTen + } + + + var frontEndNum = 0 + var prevFrontEndNumber : Int? + if (prevFrontEndNumber != nil){ + frontEndNum = number / Int(pow(Double(10), Double(digits - i))) + frontEndNum -= prevFrontEndNumber! + } else { + frontEndNum = number / Int(pow(Double(10), Double(digits - i))) + } + + if (frontEndNum != backEndNum){ + return false + } else { + moduleOfTen *= 10 + prevBackEndNumber = backEndNum + prevFrontEndNumber = frontEndNum + } + } + print(digits) + return true +} +let num = 12321 +isIntegerPalindrome(num) -*/ diff --git a/HWfrom1-10-016(BigO).playground/Contents.swift b/HWfrom1-10-016(BigO).playground/Contents.swift index 2040d38..3c580e8 100644 --- a/HWfrom1-10-016(BigO).playground/Contents.swift +++ b/HWfrom1-10-016(BigO).playground/Contents.swift @@ -12,8 +12,23 @@ https://docs.google.com/document/d/1aF1imJUVahCSJAuN1OEm5lQXwpSFaAmVmAETKMM6PLQ/ 1) + a) ANS = 160 ps + b) O(n^2) + c) O(n^2) + +2) a) n^4 , n^3 , n^2 + b) O(n!) + c) + func isDuplication -> Bool { + let friendsArray = ["mike","joe","hello"] + let unique = Array(Set(friendsArray)) + if (friendsAray == unique) { + return false + } else { + return true + } + } -2) 3) diff --git a/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift b/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift index bc0df91..d8681ed 100644 --- a/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift +++ b/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift @@ -10,20 +10,57 @@ var str = "Hello, playground" Question 1: https://www.hackerrank.com/challenges/minimum-draws Copy and paste your code: +*/ +func maxDraw (sock: Int) -> Int { + if sock == 1 { + return 2 + } else { + return sock/2 + 1 + } +} +/* +What is the big O runtime of your code?: O(1) +*/ + -What is the big O runtime of your code?: + + +/* Question 2: https://www.hackerrank.com/challenges/handshake Copy and paste your code: +*/ +func totalHandshakes(people: Int) -> Int { + + return (people - 1) * (people)/2 +} +/* +What is the big O runtime of your code?: O(1) +*/ + -What is the big O runtime of your code?: + +/* Question 3: https://www.hackerrank.com/challenges/connecting-towns Copy and paste your code: +*/ -What is the big O runtime of your code?: +func totalPath(towns:[Int]) -> Int { + if (towns.count > 0) { + var totalPath = 1 + for n in towns { + totalPath *= n + } + return totalPath + } else { + return 0 + } + +} +/* +What is the big O runtime of your code?: */ - diff --git a/calebRecursionHW/calebRecursionHW.xcodeproj/project.pbxproj b/calebRecursionHW/calebRecursionHW.xcodeproj/project.pbxproj new file mode 100644 index 0000000..672920a --- /dev/null +++ b/calebRecursionHW/calebRecursionHW.xcodeproj/project.pbxproj @@ -0,0 +1,246 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + D48F562E1C5AD57D00F290BF /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48F562D1C5AD57D00F290BF /* main.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D48F56281C5AD57D00F290BF /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + D48F562A1C5AD57D00F290BF /* calebRecursionHW */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = calebRecursionHW; sourceTree = BUILT_PRODUCTS_DIR; }; + D48F562D1C5AD57D00F290BF /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D48F56271C5AD57D00F290BF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D48F56211C5AD57D00F290BF = { + isa = PBXGroup; + children = ( + D48F562C1C5AD57D00F290BF /* calebRecursionHW */, + D48F562B1C5AD57D00F290BF /* Products */, + ); + sourceTree = ""; + }; + D48F562B1C5AD57D00F290BF /* Products */ = { + isa = PBXGroup; + children = ( + D48F562A1C5AD57D00F290BF /* calebRecursionHW */, + ); + name = Products; + sourceTree = ""; + }; + D48F562C1C5AD57D00F290BF /* calebRecursionHW */ = { + isa = PBXGroup; + children = ( + D48F562D1C5AD57D00F290BF /* main.swift */, + ); + path = calebRecursionHW; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + D48F56291C5AD57D00F290BF /* calebRecursionHW */ = { + isa = PBXNativeTarget; + buildConfigurationList = D48F56311C5AD57D00F290BF /* Build configuration list for PBXNativeTarget "calebRecursionHW" */; + buildPhases = ( + D48F56261C5AD57D00F290BF /* Sources */, + D48F56271C5AD57D00F290BF /* Frameworks */, + D48F56281C5AD57D00F290BF /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = calebRecursionHW; + productName = calebRecursionHW; + productReference = D48F562A1C5AD57D00F290BF /* calebRecursionHW */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D48F56221C5AD57D00F290BF /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 0720; + ORGANIZATIONNAME = "Jason Wang"; + TargetAttributes = { + D48F56291C5AD57D00F290BF = { + CreatedOnToolsVersion = 7.2; + }; + }; + }; + buildConfigurationList = D48F56251C5AD57D00F290BF /* Build configuration list for PBXProject "calebRecursionHW" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D48F56211C5AD57D00F290BF; + productRefGroup = D48F562B1C5AD57D00F290BF /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D48F56291C5AD57D00F290BF /* calebRecursionHW */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + D48F56261C5AD57D00F290BF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D48F562E1C5AD57D00F290BF /* main.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D48F562F1C5AD57D00F290BF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + D48F56301C5AD57D00F290BF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + D48F56321C5AD57D00F290BF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D48F56331C5AD57D00F290BF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D48F56251C5AD57D00F290BF /* Build configuration list for PBXProject "calebRecursionHW" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D48F562F1C5AD57D00F290BF /* Debug */, + D48F56301C5AD57D00F290BF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D48F56311C5AD57D00F290BF /* Build configuration list for PBXNativeTarget "calebRecursionHW" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D48F56321C5AD57D00F290BF /* Debug */, + D48F56331C5AD57D00F290BF /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = D48F56221C5AD57D00F290BF /* Project object */; +} diff --git a/calebRecursionHW/calebRecursionHW.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/calebRecursionHW/calebRecursionHW.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..18b8165 --- /dev/null +++ b/calebRecursionHW/calebRecursionHW.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/calebRecursionHW/calebRecursionHW/main.swift b/calebRecursionHW/calebRecursionHW/main.swift new file mode 100644 index 0000000..2f54b40 --- /dev/null +++ b/calebRecursionHW/calebRecursionHW/main.swift @@ -0,0 +1,38 @@ +// +// main.swift +// calebRecursionHW +// +// Created by Jason Wang on 1/28/16. +// Copyright © 2016 Jason Wang. All rights reserved. +// + +import Foundation + + +func findFile(name: String, atPath: String) -> String { + let fileManager = NSFileManager.defaultManager() + let contents = try! fileManager.contentsOfDirectoryAtPath(atPath) + for fileOrDir in contents { + var isDir = ObjCBool(false); + let fullPath = atPath + "/" + fileOrDir + let exists = fileManager.fileExistsAtPath(fullPath, isDirectory: &isDir) + if exists && Bool(isDir) { + // YOUR CODE HERE + print("DIR: " + fileOrDir) + let result = findFile(name, atPath: fullPath) + if result != "NOT FOUND" { + return result + } + } else if exists { + // YOUR CODE HERE + if fileOrDir == name { + return "FOUND" + "FILE: " + fullPath + } + } else { + print("NEITHER: " + fileOrDir) + } + } + return "NOT FOUND" +} + +print(findFile("20160112JasonWang.pdf", atPath: "/Users/jasonwang/Documents"))