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 getAspectRatio(img) { | |
return img.width / img.height; | |
} | |
function getImgFormat(img) { | |
var aspectRatio = getAspectRatio(img); | |
if(aspectRatio === 1) { | |
return 'square'; | |
} else if (aspectRatio > 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
import java.util.Scanner; | |
public class Dois | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner in = new Scanner(System.in); | |
int n = in.nextInt(); | |
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
class Even extends Thread | |
{ | |
Holder h; | |
Even(Holder h) | |
{ | |
this.h = h; | |
} | |
public void run() |
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
package br.com.car.decorator; | |
interface Car | |
{ | |
int getHp(); | |
float getPrice(); | |
} |
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
void removeDuplicate(List<?> l) | |
{ | |
if(l.isEmpty() || l.size() == 1) | |
{ | |
return; | |
} | |
List<Integer> toRemove = new ArrayList<Integer>(); | |
for(int i = 0; i < l.size(); i++) | |
{ | |
for(int j = i+1; j < l.size(); j++) |
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 Chain{ | |
private List<Cart> carts = new ArrayList<Cart>(); | |
private void attach(Cart c) | |
{ | |
if(getSize() >= 2) // If chain has no more than 2 carts , then leave both carts edge field set to true | |
{ | |
getLastCart().setEdge(false); | |
} |
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
from Population import Population | |
from Individual import Individual | |
from random import random, randint | |
class Algorithm(): | |
#Constants | |
Uniform_rate = 0.5 | |
Mutation_rate = 0.015 | |
Tournament_size = 5 |