parent
1890db68dd
commit
81f70fccfe
@ -0,0 +1,25 @@
|
|||||||
|
package com.olexyn.field.kit.hacker.rank.problems;
|
||||||
|
|
||||||
|
public class CatMouseABC {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static String catAndMouse(int x, int y, int z) {
|
||||||
|
|
||||||
|
int dx = Math.abs(x - z);
|
||||||
|
int dy = Math.abs(y - z);
|
||||||
|
if (dx == dy) {
|
||||||
|
return "Mouse C";
|
||||||
|
}
|
||||||
|
if (dx < dy) {
|
||||||
|
return "Cat A";
|
||||||
|
}
|
||||||
|
return "Cat B";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.olexyn.field.kit.hacker.rank.problems;
|
||||||
|
|
||||||
|
public class KeysBudget {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int getMoneySpent(int[] keyboards, int[] drives, int b) {
|
||||||
|
int max = -1;
|
||||||
|
|
||||||
|
for (int k : keyboards) {
|
||||||
|
for (int d : drives) {
|
||||||
|
int sum = k + d;
|
||||||
|
if (sum <= b && sum > max) {
|
||||||
|
max = sum;
|
||||||
|
}
|
||||||
|
if (max == b) {
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
package org.example;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hello world!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class App
|
|
||||||
{
|
|
||||||
public static void main( String[] args )
|
|
||||||
{
|
|
||||||
System.out.println( "Hello World!" );
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue