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 <algorithm> | |
using namespace std; | |
int main(int argc, const char * argv[]) { | |
const int COUNT = 10; | |
int sequence[COUNT] = {7, 3, 4, 5, 1, 4, 2, 4, 6, 3}; | |
int length[COUNT]; | |
for (int i = 0; i < COUNT; ++i) { | |
int max = 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
#!/bin/sh | |
fetch_dir="/home/aaron67/prj/FetchLeetcodeSubmission/release" | |
src_dir="/home/aaron67/prj/leetcode-oj-submissions" | |
# 更新 | |
cd $src_dir | |
/usr/bin/git pull | |
# 抓取 | |
cd $fetch_dir | |
/usr/bin/git pull | |
/usr/bin/java -jar FetchLeetcodeSubmission.jar |
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 cc.aaron67.test; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class UserStatistics { | |
private static List<User> userList; | |
public static void main(String[] 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 <iostream> | |
#include <vector> | |
using namespace std; | |
class Solution { | |
public: | |
int f(int x, int y) { | |
vec.resize(x + 1); | |
for (int i = 0; i < x + 1; ++i) { | |
vec[i] = vector<int>(y + 1, 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
class LRUCache{ | |
public: | |
LRUCache(int capacity) { | |
m_capacity = capacity; | |
} | |
int get(int key) { | |
if (m_dic.count(key) == 1) { // key存在 | |
int value = m_dic[key]->second; // 取对应的value | |
m_cache.erase(m_dic[key]); // 在cache-list中删掉元素 |
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> &split(const string &s, char delim, vector<int> &elems) { | |
stringstream ss(s); | |
string item; | |
while(getline(ss, item, delim)) { | |
elems.push_back(atoi(item.c_str())); | |
} | |
return elems; | |
} |
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
// | |
// skate-shoes-rent-system | |
// | |
// Created by aaron67 on 15/9/6. | |
// Copyright (c) 2015年 aaron67. All rights reserved. | |
// | |
// Mac OS X Yosemite环境测试可用 | |
// 在可执行文件相同路径下,新建文件 | |
// - rent.dat | |
// - shoes.dat |
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
// | |
// main.cpp | |
// director-random-distribute-via-weight-0 | |
// | |
// 有 N 个消费者,分别有相应的权值 | |
// 随机分发消息队列中的消息 | |
// 各个消费者消费的消息数量的比值,总体近似为权值的比值 | |
// | |
// Created by aaron67 on 15/10/13. | |
// Copyright © 2015年 aaron67. All rights reserved. |
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
// | |
// director-random-distribute-via-weight-2 | |
// | |
// 有 N 个消费者,分别有相应的权值 | |
// 随机分发消息队列中的消息 | |
// 各个消费者消费的消息数量的比值,总体近似为权值的比值 | |
// | |
#include <iostream> | |
#include <vector> |
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
// | |
// director-random-distribute-via-weight-1 | |
// | |
// 有 N 个消费者,分别有相应的权值 | |
// 随机分发消息队列中的消息 | |
// 各个消费者消费的消息数量的比值,总体近似为权值的比值 | |
// | |
#include <iostream> | |
#include <vector> |
OlderNewer