Skip to content

Instantly share code, notes, and snippets.

View antrix1989's full-sized avatar

Sergei Demchenko antrix1989

  • Microsoft
  • Vancouver, BC
View GitHub Profile
//
// main.m
// alg
//
// Created by Sergey Demchenko on 10/6/16.
// Copyright © 2016 Antrix. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// main.m
// alg
//
// Created by Sergey Demchenko on 10/6/16.
// Copyright © 2016 Antrix. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// main.m
// alg
//
// Created by Sergey Demchenko on 10/6/16.
// Copyright © 2016 Antrix. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// main.m
// alg
//
// Created by Sergey Demchenko on 10/6/16.
// Copyright © 2016 Antrix. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
//225. Implement Stack using Queues
@interface NSMutableArray (QueueAdditions)
- (id) dequeue;
- (void)enqueue:(id)obj;
@end
#import <Foundation/Foundation.h>
//Given a binary tree, return all root-to-leaf paths.
//
//For example, given the following binary tree:
//
// 1
// / \
// 2 3
// \
#import <Foundation/Foundation.h>
//Given a binary tree, return all root-to-leaf paths.
//
//For example, given the following binary tree:
//
// 1
// / \
// 2 3
// \
#import <Foundation/Foundation.h>
//Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
//
//For example:
//Given the below binary tree and sum = 22,
// 5
// / \
// 4 8
// / / \
#import <Foundation/Foundation.h>
//Same Tree.
@interface Node: NSObject
@property (nonatomic) Node *left;
@property (nonatomic) Node *right;
@property (nonatomic) NSString *value;
@end
#import <Foundation/Foundation.h>
//Given a binary tree, find its maximum depth.
@interface Node: NSObject
@property (nonatomic) Node *left;
@property (nonatomic) Node *right;
@property (nonatomic) NSString *value;
@end