View UIAutoLayout.m
This file contains 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
// | |
// ViewController.m | |
// testLayout | |
// | |
// Created by Ben Liu on 19/11/2015. | |
// Copyright (c) 2015 Ben Liu. All rights reserved. | |
// | |
#import "ViewController.h" |
View TestingAndroidProject_.idea_.name
This file contains 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
TestingAndroid |
View 202_Happy_Number_v1.py
This file contains 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
class Solution(object): | |
def isHappy(self, n): | |
""" | |
:type n: int | |
:rtype: bool | |
Be careful, this is NOT correct code, teaching purpose only | |
""" | |
def rec_happy(n): |
View 202_Happy_Number_v3.py
This file contains 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
class Solution(object): | |
def isHappy(self, n): | |
""" | |
:type n: int | |
:rtype: bool | |
""" | |
ary_temp= [] | |
def rec_happy(n): | |
sz= str(n) | |
sum= 0 |
View 202_Happy_Number_v2.py
This file contains 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
class Solution(object): | |
def isHappy(self, n): | |
""" | |
:type n: int | |
:rtype: bool | |
""" | |
def rec_happy(n, ary_temp): | |
sz= str(n) | |
sum= 0 |
View example1UsingMas_topLayoutGuide_v0.m
This file contains 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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
UIView *sv= self.view; | |
UIView *view1= [[UIView alloc] init]; | |
[sv addSubview:view1]; | |
view1.backgroundColor= [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0]; | |
[view1 mas_makeConstraints:^(MASConstraintMaker *make) { | |
make.top.equalTo(sv); |
View example1UsingMas_topLayoutGuide_v2.m
This file contains 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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
UIView *sv= self.view; | |
UIView *view1= [[UIView alloc] init]; | |
[sv addSubview:view1]; | |
view1.backgroundColor= [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0]; | |
[view1 mas_makeConstraints:^(MASConstraintMaker *make) { | |
make.top.equalTo(@([[UIApplication sharedApplication] statusBarFrame].size.height)); |
View example1UsingMas_topLayoutGuide_v1.m
This file contains 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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
UIView *sv= self.view; | |
UIView *view1= [[UIView alloc] init]; | |
[sv addSubview:view1]; | |
view1.backgroundColor= [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0]; | |
[view1 mas_makeConstraints:^(MASConstraintMaker *make) { | |
make.top.equalTo(self.mas_topLayoutGuide); |
View lc238_solution1
This file contains 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
class Solution(object): | |
# Solution 1 | |
# not passing the performance requirements | |
def productExceptSelf1(self, nums): | |
""" | |
:type nums: List[int] | |
:rtype: List[int] | |
""" | |
aryRes = [] | |
import copy |
View lc238_solution2
This file contains 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
def productExceptSelf2(self, nums): | |
""" | |
:type nums: List[int] | |
:rtype: List[int] | |
""" | |
aryRes = [] | |
for index in range(len(nums)): | |
#print nums[:index], nums[index+1:] | |
product_left = reduce(lambda x,y:x*y,nums[:index]) if(nums[:index]!=[]) else 1 | |
product_right = reduce(lambda x,y:x*y,nums[index+1:]) if(nums[index+1:]!=[]) else 1 |
OlderNewer