Skip to content

Instantly share code, notes, and snippets.

View maksadbek's full-sized avatar
💭
Chilling

Maksadbek maksadbek

💭
Chilling
View GitHub Profile
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
@maksadbek
maksadbek / gist:6283393
Last active December 21, 2015 09:09
int2char'n char2int in C++
//from int to char
while(n>0){
ch[i]=(n%10)+'0';
n=n/10;
i++;
}
while(i>0){
putchar(ch[i-1]);
i--
}
class MessagingController < ApplicationController
  include ActionController::Live
 
  def send_message
    response.headers['Content-Type'] = 'text/event-stream'
    10.times {
      response.stream.write "This is a test Messagen"
      sleep 1
    }
    response.stream.close
#####################################
##########Puzzle#####################
#####################################
read(n,m,f[1..m])
sort(f[1..m])
best = INFINITY
for k=1 to m-n
best = min(best, f[k+n-1]-f[k])
print best
Jonathan Paulson, 11th in ACM-ICPC 2013, GCJ 2013 Finals
Votes by Max Plank, Anton Leonov, Ben Alpert, and 220 more.
Go to Timus Online Judge, and work down in order. If you get bored, skip down a ways. If you can't solve the problem, look at the per-problem forum. If that doesn't help, ask someone (like StackOverflow, or a friend, or Quora, or...)
Once you've done 50-100 of those, you can write some code and maybe know a few basic algorithms. Go to Codeforces and do their weekly-ish contests. Do TopCoder contests too. When you don't get problems, figure them out afterwards.
Once you get into Div 1 on Codeforces/TopCoder, you have some skills:
1) You are an algorithms/data structures "expert". You probably know as much as most undergraduates at top CS schools and enough to get a job at Google or similar
2) You can actually write code, which is apparently a surprisingly rare skill.
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
vector<double> v;
double n;
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> inputs;
int input;
while(cin>>input)
inputs.push_back(input);
int length = inputs.size();
#include <iostream>
#include <cmath>
using namespace std;
int multi(int x, int y){
if(y==0)
return 0;
int z = multi(x, y/2);
if(y%2 == 0)
return 2*z;
else
#include "iostream"
#include "vector"
using namespace std;
int main(){
int input;
int inputs;
bool existence = false;
vector<int> values;
#include "iostream"
#include "vector"
using namespace std;
int main(){
int input;
int inputs;
bool existence = false;
vector<int> values;