This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func findIndexOf(targetSum sum: Int, in inputArray: [Int]) -> (Int,Int) { | |
//Output index | |
var indices: (Int,Int) = (-1, -1) | |
//count of input array | |
let inputArrayCount = inputArray.count | |
for (index, eachElement) in inputArray.enumerated() { | |
for sartIndex in index..<inputArrayCount { | |
if eachElement + inputArray[sartIndex] == sum { |
General iOS, CS questions and interview prep resources.
-
iOS Interview Questions for Senior Developers (useful even if you're not senior yet)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Write your code here | |
func solve() { | |
// know the cost of balloons | |
let costOfBallons = getArray(readLine()!) | |
// know the number of participants | |
let numberOfParticipant = Int(readLine()!)! | |
// some holder to capture who has solved the problem | |
var firstParticipantSolved = 0 |
NewerOlder