
Untitled
By: a guest on
Aug 21st, 2012 | syntax:
None | size: 1.67 KB | hits: 19 | expires: Never
//
// sddsfAppDelegate.m
// sddsf
//
// Created by Iffat Razzaq on 12/21/11.
// Copyright 2011 nUCROSOFT. All rights reserved.
//
#import "sddsfAppDelegate.h"
@implementation sddsfAppDelegate
@synthesize window = _window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
NSArray *arr = [NSArray arrayWithObjects:[NSNumber numberWithInt:4],
[NSNumber numberWithInt:3],
[NSNumber numberWithInt:5],
[NSNumber numberWithInt:1],
[NSNumber numberWithInt:4],
[NSNumber numberWithInt:5],nil];
int result = [self findLastInArray:arr occurance:4];
return YES;
}
- (NSInteger)findLastInArray:(NSArray *)arr occurance:(NSInteger)ocr {
return [self findLastInArray:arr
occurance:4
flag:-1
position:0];
}
- (NSInteger)findLastInArray:(NSArray *)arr occurance:(NSInteger)ocr flag:(NSInteger)flag position:(NSInteger)pos {
if (pos >= [arr count]) {
return flag;
}
if (ocr == [[arr objectAtIndex:pos] intValue]) {
flag = pos;
}
return [self findLastInArray:arr
occurance:ocr
flag:flag
position:++pos];
}
@end