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/zsh | |
autoload -U colors && colors | |
autoload -U compinit && compinit | |
export PATH=/apollo/bin:$PATH | |
export PATH=/apollo/env/envImprovement/bin:$PATH | |
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' | |
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%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
public class Solution { | |
public int findMin(int[] num) { | |
return findMin(num, 0, num.length); | |
} | |
private int findMin(int[] num, int start, int end) { | |
if (end - start <= 2) | |
return Math.min(num[start], num[end - 1]); | |
int medium = (start + end) / 2; | |
if (num[medium] > num[end - 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
public class Solution { | |
public int findMin(int[] num) { | |
return findMin(num, 0, num.length); | |
} | |
private int findMin(int[] num, int start, int end) { | |
if (end - start <= 2) | |
return Math.min(num[start], num[end - 1]); | |
int medium = (start + end) / 2; | |
if (num[medium] > num[end - 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
public class Solution { | |
public int maxProduct(int[] A) { | |
if (A == null || A.length == 0) | |
return 0; | |
int high = A[0], low = A[0]; | |
int result = A[0]; | |
for (int i = 1; i < A.length; i ++) { | |
int tmp = Math.max(A[i] * low, Math.max(A[i], A[i] * high)); | |
low = Math.min(A[i] * low, Math.min(A[i], A[i] * high)); | |
high = tmp; |
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
function y = objective(x) | |
global rho alpha eta beta delta W r smin smax fspace cr egrid P theta lbar Pw | |
beta = 0.92; | |
alpha = 2/3; | |
eta = 0.85; % decreasing returns | |
delta = 0.06; | |
Lbar = 1; | |
spliorder = 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
Tinit = 50; % periods to initialize distribution of assets | |
T = 10; % periods to simulate allocations | |
%Nf = 50000; % # producers | |
Nf = 500; | |
randn('state', 100); | |
rand('state', 100); | |
Pcum = P*triu(ones(size(P))); % cumulative ergodic distributon | |
ppi = [0; cumsum(Perg)]; |
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
T = 1000; % periods we wait for weights to converge | |
K = 5001; | |
K = 1101; | |
agrid = nodeunif(K, smin(1), smax(1)); | |
edges = [agrid(1); (agrid(2:end-1) + agrid(1:end-2))/2; agrid(end)]; | |
state = gridmake(agrid, (1:1:k)'); | |
N = size(state, 1); | |
n = 1/N*ones(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
%%% Calibration for Vietnam Census Data 2000-2009 %%% | |
clear; | |
clc; | |
format short; | |
%theta = 0.265193716508201; | |
theta = 0.60; | |
rho = 0.411821223252127; | |
se = 1.866148709477601; | |
W = 0.967988540291824; |
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
import random | |
import math | |
class Point: | |
def __init__(self, x, y): | |
this.x = x | |
this.y = y | |
def distance( |
NewerOlder