Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
553 changes: 553 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RSSchool_T2.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
18 changes: 18 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/1/KidnapperNote.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import <Foundation/Foundation.h>
/*
Harold is a kidnapper who wrote a ransom note, but now he is worried it will be traced back to him through his handwriting. He found a magazine and wants to know if he can cut out whole words from it and use them to create an untraceable replica of his ransom note. The words in his note are case-insensitive and he must use only whole words available in the magazine. He cannot use substrings or concatenation to create the words he needs.
Given the words in the magazine and the words in the ransom note, complete the checkMagazine function to return YES if he can replicate his ransom note exactly using whole words from the magazine; otherwise, return NO.
For example, the note is "Attack At Dawn". The magazine contains only "attack at dawn". The magazine has all the right words and even if there's a case mismatch, the answer is YES.
Another example, the note says "give two grand today" and the magazine contains "give me one grand today night". The magazine doesnt have all the right words, so the answer is NO.
*/

@interface KidnapperNote : NSObject
/**
A function to check if a magazine can be used for a ransom note.

@param magaine a string, representing the text of a magazine
@param note a string, representing a desired ransom note
@return flag indicating if a magazine can be used for a ransom note, YES or NO
*/
- (BOOL)checkMagazine:(NSString *)magaine note:(NSString *)note;
@end
5 changes: 5 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/1/KidnapperNote.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "KidnapperNote.h"

@implementation KidnapperNote
// your code here
@end
41 changes: 41 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/2/RomanTranslator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#import <Foundation/Foundation.h>
/*
A roman translator Brutus was hired by a merchant.
Brutus will be responsible for translating arabic numerals to roman and vise-versa
You need to help him and implement a couple of handy methods.
Roman numbers are represented by 7 different letters:

Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000

For example, two is written as II in Roman numeral, just two one's added together. Twelve is written as, XII, which is simply X + II. The number twenty seven is written as XXVII, which is XX + V + II.

Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used:

I can be placed before V (5) and X (10) to make 4 and 9.
X can be placed before L (50) and C (100) to make 40 and 90.
C can be placed before D (500) and M (1000) to make 400 and 900.
*/

@interface RomanTranslator : NSObject
/**
Arabic to roman numbers converter

@param arabicString a regular (arabic) number string
@return a roman representation
*/
- (NSString *)romanFromArabic:(NSString *)arabicString;
/**
Roman to arabic numbers converter

@param romanString a roman number string
@return an arabic number string
*/
- (NSString *)arabicFromRoman:(NSString *)romanString;
@end
5 changes: 5 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/2/RomanTranslator.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "RomanTranslator.h"

@implementation RomanTranslator
// your code here
@end
46 changes: 46 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/3/DoomsdayMachine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#import <Foundation/Foundation.h>
/*
You are a Borg and you are going to assimilate the humans.
The date of assimilation is set to 14 August 2208 03:13:37 (in obsolete human calendar)
However, the Borg messep up the date format with their own,
so 26 March 2019 12:34:56 in human will look like:
2019:03:26@56\34/12

As an engineer, you need to design a program which will take a messed up date string and
return how many years, months, weeks, days, hours, minutes and seconds left between
the specified date and the assimilation date. You need to create a class conforming to
AssimilationInfo protocol and use it as a wrapper for the returned data.
- Example
Input: 2200:01:01@15\30/00
Output: AssimilationInfo(years:8, months:7, days:13, hours:2, minutes:43, seconds:22)

The machine should also be able to return the assimilation date in string
representation for humans to behold and the format should be easily read by them.
(as it would be displayed on the countdown screen)
- Example
Output: Sunday, August 14, 2208
*/
@protocol AssimilationInfo <NSObject>
@property (nonatomic, readonly) NSInteger years;
@property (nonatomic, readonly) NSInteger months;
@property (nonatomic, readonly) NSInteger weeks;
@property (nonatomic, readonly) NSInteger days;
@property (nonatomic, readonly) NSInteger hours;
@property (nonatomic, readonly) NSInteger minutes;
@property (nonatomic, readonly) NSInteger seconds;
@end
@interface DoomsdayMachine : NSObject
/**
Returns AssimilationInfo for a gived date string

@param dateString a date string in a messed up Borg format
@return AssimilationInfo for the specified date
*/
- (id<AssimilationInfo>)assimilationInfoForCurrentDateString:(NSString *)dateString;
/**
Returns a human-readable string of the assimilation date

@return a human-readable string
*/
- (NSString *)doomsdayString;
@end
5 changes: 5 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/3/DoomsdayMachine.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "DoomsdayMachine.h"

@implementation DoomsdayMachine
// your code here
@end
40 changes: 40 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/4/MatrixHacker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#import <Foundation/Foundation.h>
/*
Agent Smith is taking over the Matrix, turning everyone into his clones.
Luckily, Neo hacked into the system and is able to inject arbitrary code.
Turned out the Matrix is written in Objective-C, so he needs your help.

You need to implement a method injectCode: which would take a block and peersist it.
Later, when runCodeWithData: is called, the class should apply the saved block to each
element of the array, creating either a character with the same name either a clone
named "Agent Smith". If the name is not "Neo", the clone of "Agent Smith" is created.

- Example:
Input: ["Jane Doe", "Delivery Guy", "Postman", "Neo", "Agent John", "Dog"]
Output: [Character(name: "Agent Smith", isClone: true),
Character(name: "Agent Smith", isClone: true),
Character(name: "Agent Smith", isClone: true),
Character(name: "Neo", isClone: false),
Character(name: "Agent Smith", isClone: true),
Character(name: "Agent Smith", isClone: true)]
*/
@protocol Character <NSObject>
- (NSString *)name;
- (BOOL)isClone;
+ (instancetype)createWithName:(NSString *)name isClone:(BOOL)clone;
@end
@interface MatrixHacker : NSObject
/**
Injects the given block into the Matrix by saving it in the class.

@param theBlock the block of code to be injected
*/
- (void)injectCode:(id<Character> (^)(NSString *name))theBlock;
/**
Runs the saved block of code against every element of the array

@param names the array of names of characters
@return an array of character after applying the injected block
*/
- (NSArray<id<Character>> *)runCodeWithData:(NSArray<NSString *> *)names;
@end
5 changes: 5 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/4/MatrixHacker.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "MatrixHacker.h"
// your code here
@implementation MatrixHacker
// your code here
@end
27 changes: 27 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/5/TinyURL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#import <Foundation/Foundation.h>
/*
URL shortening services like tinyurl.com or vk.cc allow you to enter a URL
such as https://drive.google.com/file/d/1EBGP1ntXPGVSfYyKGenOdzgh_hna4vg4/view
and get back a short one such as https://vk.cc/9dEj5S

Design the encode and decode methods for the TinyURL service.
There is no restriction on how your encode/decode algorithm should work.
You just need to ensure that a URL can be encoded to a tiny URL
and the tiny URL can be decoded to the original URL.
*/
@interface TinyURL : NSObject
/**
Takes a URL and encodes it into a tiny format

@param originalURL the URL
@return encoded URL
*/
- (NSURL *)encode:(NSURL *)originalURL;
/**
Taken an encoded URL and returns its original form

@param shortenedURL encoded URL
@return original URL
*/
- (NSURL *)decode:(NSURL *)shortenedURL;
@end
5 changes: 5 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/5/TinyURL.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "TinyURL.h"

@implementation TinyURL
// your code here
@end
9 changes: 9 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/Irrelevant/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

21 changes: 21 additions & 0 deletions Tasks/Task2/RSSchool_T2/RSSchool_T2/Irrelevant/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#import "AppDelegate.h"

@interface AppDelegate ()
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window setRootViewController: [UIViewController new]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {}
- (void)applicationDidEnterBackground:(UIApplication *)application {}
- (void)applicationWillEnterForeground:(UIApplication *)application {}
- (void)applicationDidBecomeActive:(UIApplication *)application {}
- (void)applicationWillTerminate:(UIApplication *)application {}
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading