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
static int getMinPathValue(int[][] input) { | |
int[] firstLine = input[0]; | |
ArrayList<Integer> buff = new ArrayList<Integer>(Collections.nCopies(firstLine.length, Integer.MAX_VALUE)); | |
int result = 0; | |
for (int y=0; y<input.length; y++) { | |
for (int x=0; x<input.length; x++) { | |
if (input[y][x] < buff.get(x)) { | |
buff.set(x, input[y][x]); |
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
const NSTimeInterval INTERVAL_TIME = 0.5; // 0.5 sec | |
RACSubject *subject = [RACSubject subject]; | |
[[subject throttle:INTERVAL_TIME] subscribeNext:^(id _Nullable x) { | |
NSLog(@"%@",x); | |
}]; | |
[subject sendNext:@1]; | |
[subject sendNext:@2]; | |
[subject sendNext:@3]; | |
[subject sendNext:@4]; |
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
RAC(self.labelView, text) = [RACObserve(objA, strContent) distinctUntilChanged]; | |
objA.strContent = @"content1"; // 1st | |
objA.strContent = @"content1"; // 2nd | |
objA.strContent = @"content1"; // 3rd |
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
function main(data,cb){ | |
fun1(data,function(err,data){ | |
if(!err){ | |
fun2(data,function(err,data){ | |
if(!err){ | |
fun3(data,cb); | |
}else{ | |
cb(err); | |
} | |
}); |
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
// Define function | |
- (RACSignal *)RACSignalDemoA { | |
return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { | |
NSLog(@"handle A"); | |
[subscriber sendNext:@"A"]; | |
[subscriber sendCompleted]; | |
return nil; | |
}]; | |
} |
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
- (RACSignal *)RACSignalDemoFunction { | |
return [RACSignal createSignal:^(id<RACSubscriber> subscriber) { | |
// your code ... | |
BOOL isSuccess = YES; | |
NSObject *result = [NSObject new]; | |
if (isSuccess) { | |
[subscriber sendNext:result]; | |
[subscriber sendCompleted]; | |
} else { |
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
// JAVA | |
// QUESTION 1 | |
static String getReverseString(String input) { | |
char[] in = input.toCharArray(); | |
char buff; | |
for (int i=0,j=input.length()-1; i<input.length()/2;i++,j--) { | |
buff = in[i]; | |
in[i] = in[j]; | |
in[j] = buff; | |
} |
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
@interface Model:NSObject | |
@property (strong, nonatomic) NSString *content; | |
@end | |
@implementation Model | |
@end | |
@interface ViewModel:NSObject | |
@property (strong, nonatomic) NSString *content; | |
- (void) execute:(NSString *)content; |
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
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:UIKeyboardDidShowNotification object:nil] subscribeNext:^(NSNotification * _Nullable x) { | |
NSLog(@"keyboard - \n%@", x); | |
}]; |