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
| /** | |
| * Copyright (C) 2015 uphy.jp | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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 Python: | |
| def __init__(self, name): | |
| self.name = name | |
| print name |
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 TicketLine { | |
| public static String Tickets(int[] peopleInLine) { | |
| int money=0; | |
| for(int i = 0;i<peopleInLine.length;i++){ | |
| if(peopleInLine[i] == 50){ | |
| if (money < 25) return "NO"; | |
| else money+=25; | |
| } |
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 capitals(word): | |
| lst = [] | |
| for i,ch in enumerate(word): | |
| if ch.isupper(): | |
| lst.append(i) | |
| return lst | |
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
| import java.util.regex.Pattern; | |
| import java.util.regex.Matcher; | |
| public class BatmanQuotes{ | |
| public static int indexOf(Pattern pattern, String s) { | |
| Matcher matcher = pattern.matcher(s); | |
| return matcher.find() ? matcher.start() : -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
| import java.lang.StringBuilder; | |
| public class Bio { | |
| public static String dnaToRna(String dna){ | |
| StringBuilder strb = new StringBuilder(dna); | |
| while(strb.indexOf("T") != -1) { | |
| strb.replace(strb.indexOf("T"),strb.indexOf("T")+1,"U"); | |
| } |
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 Negative { | |
| public static int makeNegative(final int x) { | |
| if(x >= 0) return -x; | |
| else return x; | |
| } | |
| } |
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 Number { | |
| public boolean isEven(double n) { | |
| if (n % 2 == 0) return true; | |
| else return false; | |
| } | |
| } |
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
| import java.lang.StringBuilder; | |
| public class ReverseLonger { | |
| public static String shorterReverseLonger(String a, String b) { | |
| if (a.length() < b.length()) { | |
| return a + reverse(b) + a; | |
| } else { | |
| return b + reverse(a) + b; | |
| } |
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
| import java.util.LinkedList; | |
| import java.lang.Math; | |
| public class SquareDigit { | |
| LinkedList<Integer> stack = new LinkedList<Integer>(); //stack where I'll push each digit for easy ordered extraction | |
| String str = ""; | |
| /** | |
| * this method receives a number and returns a number which digits are the input number's digits square. |