This file contains hidden or 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 WihoutLoop{ | |
| public static void main(String []args){ | |
| reachfinal(0,100); | |
| } | |
| public static void reachfinal(int startpoint, int finalpoint){ | |
| if (startpoint != finalpoint){ | |
| System.out.println(startpoint); | |
| reachfinal(startpoint+1, finalpoint); |
This file contains hidden or 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
| def create_matrix(width, height): | |
| result = [] | |
| for i in range(height): | |
| result.append([0 for i in range(width)]) | |
| print (result) | |
| # TOP BOTTOM LEFT RIGHT | |
| T = 0 | |
| B = height - 1 |
This file contains hidden or 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 Button extends React.Component { | |
| // constructor (props) { | |
| // super(props); | |
| // this.state = { counter: 0 }; | |
| // } | |
| state = { counter: 0 } | |
| handleClick = () => { | |
| // this.state.counter++ | |
| this.setState((prevState) => ({ |
This file contains hidden or 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
| sudo apt-get install redis-server | |
| sudo /etc/init.d/redis-server restart | |
| neo4j start | |
| neo4j status | |
| sudo apt-get install mongodb-server | |
| sudo apt-get install mongodb-clients | |
| killall mongod | |
| cd ~ |
This file contains hidden or 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
| def solution(X, Y, D): | |
| # write your code in Python 2.7 | |
| gap = Y-X | |
| if gap % D == 0: | |
| return gap / D | |
| else: | |
| return gap / D + 1 |
This file contains hidden or 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
| from collections import deque | |
| # you can write to stdout for debugging purposes, e.g. | |
| # print "this is a debug message" | |
| def solution(A, K): | |
| # write your code in Python 2.7 | |
| d=deque(A) | |
| d.rotate(K) | |
| return list(d) |
This file contains hidden or 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
| def solution(N): | |
| # write your code in Python 2.7 | |
| bin_representation = "{0:b}".format(N) | |
| bin_representation = 'x' + bin_representation | |
| bin_representation = bin_representation + 'x' | |
| start_index = [i for i in range(0, len(bin_representation)) if ((bin_representation[i] == '1') and (bin_representation[i+1]=='0'))] | |
| end_index = [i for i in range(0, len(bin_representation)) if ((bin_representation[i] == '1') and (bin_representation[i-1]=='0'))] | |
| print(start_index) |
This file contains hidden or 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/python3 | |
| import sys | |
| n = int(input().strip()) | |
| scores = list(map(int, input().strip().split(' '))) | |
| # your code goes here | |
| # highest score | |
| max = -float("inf") |
OlderNewer