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
Java constant - final |
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> | |
#include "extern_const.hpp" | |
const int n = 10; | |
//const int a[] = {1, 2}; // this is also ok | |
extern const int a[] = {1, 2}; | |
int main(int argc, char *argv[]) | |
{ | |
increse(); |
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
package lambda; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Comparator; | |
/** | |
* Created by zzt on 5/25/15. | |
* <p> | |
* Description: |
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
package so_test; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
/** | |
* Created by zzt on 7/30/15. | |
* <p> | |
* Description: | |
* Getting Iterator first then modify container will |
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 <stdio.h> | |
#include "var.h" | |
void hello1(const char *s) { | |
printf("hello1 %s\n", s); | |
} | |
void hello2(const char *s, const char* s2) { | |
printf("hello2 %s and %s\n", s, s2); | |
} |
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 "var.h" | |
#include <stdio.h> | |
#define hello1(s) hello2(s, "default string") | |
void hello2(const char *s, const char* s2) { | |
printf("hello2 %s and %s\n", s, s2); | |
} | |
#define hello(...) xglue(hello, PP_NARG(__VA_ARGS__))(__VA_ARGS__) |
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 <stdio.h> | |
#include <stdarg.h> | |
void hello2(int p1, int p2) | |
{ | |
printf("hello2 %d %d\n", p1, p2); | |
} | |
void hello3(int p1, int p2, int p3) | |
{ |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
#include "prime.h" | |
void prime(long long n) { | |
// too large n cause stack overflow | |
size_t mem = sizeof(int)*(n + 1); |
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
package interview.leetcode; | |
import competition.utility.MyIn; | |
import java.util.ArrayList; | |
/** | |
* Created by zzt on 7/6/16. | |
* <p> | |
* <h3></h3> |
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
vector<int> getNext(const string& s) { | |
vector<int> res(s.length()); | |
res[0] = -1; | |
const char* start = s.c_str(); | |
int j = -1; | |
for(int i = 0; i < s.length() - 1; ) { | |
if(j == -1) { | |
res[i + 1] = 0; | |
i++; | |
j = 0; |
OlderNewer