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 Rev: | |
def __init__(self, data): | |
self.data = data | |
self.index = len(data) | |
def __iter__(self): | |
return self | |
def __next__(self): | |
if self.index == 0: |
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 scope_test(): | |
def do_local(): | |
# print("before local " + spam) | |
spam = "local spam" | |
print("do_local: " + spam) | |
def do_nonlocal(): | |
# print("before non-local: " + spam) | |
nonlocal spam | |
spam = "nonlocal spam" | |
print("do_nonlocal: " + spam) |
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 Complex: | |
def __init__(self, real, imag, name): | |
self.r = real | |
self.i = imag | |
self.name = name | |
name = 'Complex_default' | |
r = 0.0 | |
i = 1.1 | |
doc = "default doc" |
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 Complex: | |
def __init__(self, real, imag, name): | |
self.r = real | |
self.i = imag | |
self.name = name | |
name = 'Complex_default' | |
r = 0.0 | |
i = 1.1 | |
doc = "default doc" | |
def foo(self, num): |
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
#include <iostream> | |
using namespace std; | |
class Solution { | |
public: | |
int min(int a, int b) | |
{ | |
return (a < b) ? a : b; | |
} |
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
#include <string> | |
#include <map> | |
#include <iostream> | |
using namespace std; | |
class Solution | |
{ | |
public: | |
int lengthOfLongestSubstring(string s) |
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
// AddTwoNumbers.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
/** | |
* Definition for singly-linked list. | |
* struct ListNode { | |
* int val; | |
* ListNode *next; |
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
// LongestPalindromic.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <string> | |
#include <iostream> | |
using namespace std; |
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
// atoi.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
using namespace std; | |
class Solution | |
{ |
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
// PalindromeNumber.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <math.h> | |
#include <iostream> | |
using namespace std; |
OlderNewer