public int numberOfWays(int n,int k){
        if(k < 2){
            throw new IllegalArgumentException();
        }
        LinkedList<Integer> queue = new LinkedList<Integer>();
        queue.add(1);
        queue.add(2);
        int count=0;
        for(int i=2; i < k ; i++){
            Iterator<Integer> itr = queue.iterator();
            count = 0;
            while(itr.hasNext()){
                count += itr.next();
            }
            queue.offerLast(count);
        }
        for(int i = k; i < n ; i++){
            Iterator<Integer> itr = queue.iterator();
            count = 0;
            while(itr.hasNext()){
                count += itr.next();
            }
            queue.pollFirst();
            queue.offerLast(count);
        }
        return queue.pollLast();
    }
Assumption is k is always greater than or equal to 2
src/com/interview/number/NumberOfCombinationsForStairs.java