Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Задача с собеса про логирование действий на экране
- func isNavigationSame(screensArraysOne: [String], screensArraysTwo: [String]) -> Bool {
- var pointerOne = 0
- var pointerTwo = 0
- while pointerOne < screensArraysOne.count
- || pointerTwo < screensArraysTwo.count {
- let screenOne = screensArraysOne[pointerOne]
- let screenTwo = screensArraysTwo[pointerTwo]
- if screenOne != screenTwo {
- return false
- }
- while pointerOne < screensArraysOne.count, screensArraysOne[pointerOne] == screenOne {
- pointerOne += 1
- }
- while pointerTwo < screensArraysTwo.count, screensArraysTwo[pointerTwo] == screenTwo {
- pointerTwo += 1
- }
- }
- return true
- }
- isNavigationSame(screensArraysOne: ["A", "A", "B", "C"], screensArraysTwo: ["A", "B", "B", "D"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement