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
import Foundation | |
import UIKit | |
var article = """ | |
Perjalanan penuh kisah milik bangsa Indonesia dan dunia dalam kurun waktu setengah abad ini telah terabadikan. Pada 28 Juni 2015, usia 50 tahun dicapai oleh harian umum yang didirikan PK Ojong (1920–1980) dan Jakob Oetama ini. Usia emas menjadi pertanda harian ini mampu terus hadir menemani langkah-langkah Indonesia untuk terus menginspirasi dan menjadi Amanat Hati Nurani Rakyat. | |
Dalam rangka merayakan usia 50 tahun ini, Kompas mengadakan acara Inspira(k)si. Acara ini mencakup berbagai macam program, yaitu Inspi Baca, Inspi Kendara, Inspi Sinema, Inspi Rasa, Inspi Rehat, dan Inspi Vision. Untuk dapat turut serta dalam program-program tersebut, pembaca Kompas bisa memanfaatkan kupon-kupon yang ada di koran ini pada edisi 28 Juni. | |
Berbagai promosi menarik di tiap Inspi dapat dinikmati dengan menyertakan koran Kompas dan memiliki kartu Flazz BCA atau Mandiri e-money. Inspi Baca mempersembahkan potongan harga senilai Rp 50.000. Inspi Rasa, Inspi Rehat, dan Ins |
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
/* | |
Final Attempt | |
8/8 test cases passed | |
*/ | |
func twoStrings(s1: String, s2: String) -> String { | |
let uniqueCharacters = Set(s2) | |
for char in uniqueCharacters { | |
if s1.contains(char) { | |
return "YES" | |
} |
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
/* | |
First Attempt | |
5/8 test cases passed | |
*/ | |
func twoStrings(s1: String, s2: String) -> String { | |
for char in s2 { | |
if s1.contains(char) { | |
return "YES" | |
} |
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
// Interview Preparation Kit > Arrays > 2D Array - DS | |
var arr = [[1, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 2, 4, 4, 0], [0, 0, 0, 2, 0, 0], [0, 0, 1, 2, 4, 0]] | |
var arrayOfSum : [Int] = [] | |
for row in 0..<arr.count { | |
if (row >= 0 && row <= 3) { | |
for col in 0..<arr.count { | |
if (col > 0 && col < 5) { | |
print ("row \(row) column \(col)") |
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
var c: [Int] = [0, 0, 1, 0, 0, 1, 0] | |
print("array \(c)") | |
var numberOfJumps = 0 | |
var i = 0 | |
while i < c.count { | |
if (i < c.count-1) { |