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
| /** | |
| * Created by techmaster on 2/8/17. | |
| */ | |
| /*** | |
| * Calculate factorial of n | |
| * @param n {Number} n must be integer and greater than zero | |
| */ | |
| function factorial(n) { | |
| if (isNaN(n)) { |
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
| -(void) printString: (NSString*) msg | |
| onComplete: (void (^)(void)) complete{ | |
| NSLog(@"%@", msg); | |
| complete(); | |
| } | |
| -(void) demoRecursiveBlock | |
| { | |
| __block int index = 0; | |
| NSArray* array = @[@"ABC", @"DEF", @"MNP"]; |
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 UIKit | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.addBar() | |
| } | |
| func addBar() { |
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
| // | |
| // ViewController.swift | |
| // DisplayAlert | |
| // | |
| // Created by cuong on 6/30/17. | |
| // Copyright © 2017 Techmaster. All rights reserved. | |
| // | |
| import UIKit |
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 UIKit | |
| class ViewController: UIViewController { | |
| override func loadView() { | |
| print("loadView") | |
| } | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view, typically from a nib. |
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 UIKit | |
| class ViewController: UIViewController { | |
| @IBOutlet weak var txtField: UITextField! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view, typically from a nib. | |
| } |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| int checkHopQuy(char* string); | |
| int main() | |
| { | |
| char string1[] = "a[b]c"; | |
| char string2[] = "} abc {"; | |
| char string3[] = "<ok string [good]>"; |
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
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file | |
| #include "catch.hpp" | |
| vector<int> separateOddEven(vector<int> arr) { | |
| auto left = arr.begin(); | |
| auto right = arr.end() - 1; |
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
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| /* | |
| Chuyển số chẵn về bên trái, số lẻ về bên phải | |
| http://algorithms.tutorialhorizon.com/separate-even-and-odd-integers-in-a-given-array/ | |
| int [] arrA = {1,2,3,4,6,8,7,12}; | |
| Output: [12, 2, 8, 4, 6, 3, 7, 1] | |
| */ |
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
| #include <iostream> | |
| void printBinary(int n) { | |
| int k; | |
| char *str = (char*) malloc(n * sizeof(char)); | |
| memset(str,'0', n); //set str = '00...00' | |
| printf("%s\n", str); //print base string | |
| while (1) { | |
| k = n - 1; //Tinh tu ky tu cuoi | |
| while (k >=0) { | |
| if (str[k] == '0') { |
OlderNewer