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 longestSeq(array): | |
| longestLen = 0 | |
| longestLenIndex = 0 | |
| currentLen = 0 | |
| currentIndex = 0 | |
| for i in range(len(array)): | |
| if array[i] == 1 and array[i-1] == 0 or i == 0: | |
| currentIndex = i | |
| if array[i] == 1: | |
| currentLen += 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
| def longestString(inpStr): | |
| currIndex = maxIndex = maxLen = 0 | |
| currLen = inpStr[0] | |
| for i in range(1,len(inpStr)): | |
| if inpStr[i] and not inpStr[i-1]: | |
| currIndex = i | |
| currLen = 1 | |
| if inpStr[i]: | |
| currLen += 1 | |
| if currLen > maxLen: |
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
| #(5#%)#Skriv#metoden#new_level#som#tar#inn#en#liste#(endimensjonal#tabell),# | |
| list,#bestående#av#15#heltall#i#tilfeldig#rekkefølge#som#vist#i#figur#3.#Metoden#skal# | |
| returnere#en#4x4Utabell#der#tallene#i#list#er#satt#inn#fortløpende,#radvis,#fra#rad#0,# | |
| kolonne#0,#til#rad#3,#kolonne#2.#Elementet#med#indeks#3,3#skal#ha#verdien#0. | |
| #input: a table with 15 elements, each element is between 1 and 15, all elements are unique | |
| def new_level(table): | |
| a = [[] for i in range(4)] |
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
| package chess; | |
| import chess.ChessPiece; | |
| import chess.Color; | |
| import chess.PiecePosition; | |
| import java.util.Scanner; | |
| public class GameEnginge { | |
| static CheckBoard chessBoard = new CheckBoard(); | |
| GameEnginge () { |
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
| package oving7.sudoku; | |
| import java.util.Scanner; | |
| import java.util.Random; | |
| import java.util.Stack; | |
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.io.PrintWriter; | |
| import java.util.ArrayList; | |
| import oving7.sudoku.Board; |
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
| package oving8.highscore; | |
| import java.util.List; | |
| import java.util.ArrayList; | |
| import oving8.highscore.HighscoreListener; | |
| import oving8.highscore.HighscoreListListener; | |
| public class HighscoreList { | |
| private int maxSize; |
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
| void run () throws NumberFormatException{ | |
| Scanner scan = new Scanner(System.in); | |
| scan.useDelimiter("[0-9]+"); | |
| while ( true ) { | |
| try { | |
| String inputLine = scan.nextLine(); | |
| int parseInt = Integer.parseInt(inputLine); | |
| System.out.println("input was: " + Integer.toString(parseInt)); | |
| } catch (NumberFormatException e) { | |
| System.out.println( e.toString() ); |
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
| package oving5.person; | |
| import java.util.Iterator; | |
| import java.util.function.BinaryOperator; | |
| import java.lang.Double; | |
| public class BinaryComputingIterator implements Iterator<Double>{ | |
| private Iterator<Double> firstIterator; | |
| private Iterator<Double> secondIterator; | |
| private BinaryOperator<Double> binaryOperator; |
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 sys import stdin, stderr | |
| import traceback | |
| adj_mx = [[0,1,1,0,0,0],[0,0,0,1,0,0],[0,0,0,1,1,0],[0,0,0,0,0,1],[0,1,0,1,0,1],[0,0,0,1,0,0]] | |
| class Node(): | |
| def __init__(self, num): | |
| self.points_to = [] | |
| self.num = num | |
| self.d = 0 |
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 sys import stdin, stderr | |
| import traceback | |
| adj_mx = [[0,1,1,0,0,0],[0,0,0,1,0,0],[0,0,0,1,1,0],[0,0,0,0,0,1],[0,1,0,1,0,1],[0,0,0,1,0,0]] | |
| class Node(): | |
| def __init__(self, num): | |
| self.points_to = [] | |
| self.num = num | |
| self.d = 0 |
OlderNewer