This file contains 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 UIKit | |
class A { | |
func execute(ind: Int = 0) { | |
print("A: \(ind)") | |
} | |
} | |
class B: A { | |
override func execute(ind: Int = 1) { |
This file contains 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
extension UIColor { | |
convenience init(hexString: String, alpha: CGFloat = 1.0) { | |
let hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) | |
let scanner = Scanner(string: hexString) | |
if (hexString.hasPrefix("#")) { | |
scanner.scanLocation = 1 | |
} | |
var color: UInt32 = 0 | |
scanner.scanHexInt32(&color) |
This file contains 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 | |
class Graph { | |
var nodes = [Node]() | |
var identifiersToNodes = [Int: Node]() | |
func addNode(node: Node) { | |
identifiersToNodes[node.identifier] = node | |
nodes += [node] | |
} |
This file contains 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
#include<iostream> | |
#include <math.h> | |
#include <stdlib.h> | |
using namespace std; | |
int main() | |
{ | |
int i, j, n, m; |
This file contains 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
// | |
// main.swift | |
// CountInversionWithMergeSort | |
// | |
// Created by Anthony Marchenko on 10/3/17. | |
// Copyright © 2017 Anthony Marchenko. All rights reserved. | |
// | |
import Foundation |
This file contains 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
// | |
// main.swift | |
// MaxSubArray | |
// | |
// Created by Anthony Marchenko on 10/3/17. | |
// Copyright © 2017 Anthony Marchenko. All rights reserved. | |
// | |
import Foundation |
This file contains 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
// Start of Node class | |
class Node { | |
var data: Int | |
var left: Node? | |
var right: Node? | |
init(d : Int) { | |
data = d | |
} | |
} // End of Node class |
This file contains 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 | |
// read the integer n | |
let n = Int(readLine()!)! | |
var arr = Array(repeating: "", count: n) | |
for index in 0...n-1 { | |
arr[index] = String(readLine()!) | |
} |
This file contains 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 | |
func fibonacci (n: Int) -> Int { | |
// Write your code here. | |
if (n == 0 || n == 1) { | |
return 1; | |
} | |
return fibonacci(n: n-1) + fibonacci(n: n-2) | |
} |
This file contains 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 | |
// read the integer n | |
let n = Int(readLine()!)! | |
// read the array | |
var arr = readLine()!.components(separatedBy: " ").map{ Int($0)! } | |
var swapCount = 0 |
NewerOlder