• Finding a next lucky number with C++.

    This is an easy task for Monday from Week of Code at Hackerrank. The task is to find a next lucky number based on given 6 digit integer. #include <bits/stdc++.h> #include <string> using namespace std; bool isLucky(int x) { int digit6 = x % 10;…

    Read more →


  • Missing Numbers Hackerrank problem with C++

    https://www.hackerrank.com/challenges/missing-numbers/problem Solved using sorting two arrays, finding missing number in the loop and putting them in the set. #include <cmath> #include <cstdio> #include <vector> #include <set> #include <iostream> #include <algorithm> using namespace std; set<int> findMissing(int n, vector <int> ar1, vector <int> ar2) { // using…

    Read more →


  • Insert a node into Linked list with C++

    Check if Linked List is null and just create a Node. Otherwise, run to the end of the linked list and insert a node at the end. /* Insert Node at the end of a linked list head pointer input could be NULL as well…

    Read more →


  • 2D Array easy hackerrank challenge in Swift 3

    https://www.hackerrank.com/challenges/2d-array Had to refresh memory how to parse input from Hackerrank in Swift 3. import Foundation; func run() { var arr : [[Int]] = [] for _ in 0 … 5 { let numbers = readLine()!.components(separatedBy: [” “]).map { Int($0)! } arr.append(numbers); } var maxSum…

    Read more →


  • Display image from Google Docs in the Github readme

    The easies way to add an image to the Github readme that I can think of is displaying it from Google Drive. Since the assets are already hosted there. Paste in the link into Readme.md file on github: <a href=”https://drive.google.com/uc?export=view&id=”><img src=”https://drive.google.com/uc?export=view&id=” style=”width: 500px; max-width: 100%;…

    Read more →


  • tvOS 10 wide top shelf Image size

    tvOS 10 brings new things that are required Top shelf wide image size is: 2320px by 720px

    Read more →


  • How to hide strange unwanted Xcode 8 logs

    Running app in the simulator in a new shine xcode 8 noticed that there are a lot of extra information that is coming from the logs. To disable it and see regular logs do the following: 1. Click on your project name and select “Edit…

    Read more →


  • Singleton in iOS

    Recommended way of creating singleton according to Apple is in the following way: + (AKMySingleton *)sharedInstance { static AKMySingleton *_sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _sharedInstance = [[[self class] alloc] init]; }); return _sharedInstance; } Dispatch-once is a synchronous operation that will make…

    Read more →


  • Problem Given an array of elements, find the maximum possible sum of a Contiguous subarray Non-contiguous (not necessarily contiguous) subarray. Empty subarrays/subsequences should not be considered. Input Format First line of the input has an integer . cases follow. Each test case begins with an…

    Read more →


  • Diagonal Difference from HackerRank in Swift

    Problem Given a square matrix of size , calculate the absolute difference between the sums of its diagonals. Input Format The first line contains a single integer, . The next lines denote the matrix’s rows, with each line containing space-separated integers describing the columns. Output…

    Read more →