# Take a Number And Sum Its Digits Raised To The Consecutive Powers And ....¡Eureka!!


The number 89 is the first integer with more than one digit that fulfills the property partially introduced in the title of this kata. What's the use of saying "Eureka"? Because this sum gives the same number.


In effect: 89 = 8^1 + 9^2


The next number in having this property is 135.


See this property again: 135 = 1^1 + 3^2 + 5^3


We need a function to collect these numbers, that may receive two integers a, b that defines the range [a, b] (inclusive) and outputs a list of the sorted numbers in the range that fulfills the property described above.


Let's see some cases:


sum_dig_pow(1, 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9]


sum_dig_pow(1, 100) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 89]

If there are no numbers of this kind in the range [a, b] the function should output an empty list.


sum_dig_pow(90, 100) == []

Enjoy it!!



There is an array with some numbers. All numbers are equal except for one. Try to find it!


Kata.findUniq(new double[]{ 1, 1, 1, 2, 1, 1 }); // => 2

Kata.findUniq(new double[]{ 0, 0, 0.55, 0, 0 }); // => 0.55

It’s guaranteed that array contains more than 3 numbers.


The tests contain some very huge arrays, so think about performance.




# Sort the odd


You have an array of numbers.

Your task is to sort ascending odd numbers but even numbers must be on their places.


Zero isn't an odd number and you don't need to move it. If you have an empty array, you need to return it.


Example


sortArray([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4]



2018.03.20


#Sum of the first nth term of Series 


Your task is to write a function which returns the sum of following series upto nth term(parameter).


Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +...


Rules:

- You need to round the answer to 2 decimal places and return it as String.

- If the given value is 0 then it should return 0.00

- You will only be given Natural Numbers as arguments.


Examples:

SeriesSum(1) => 1 = "1.00"

SeriesSum(2) => 1 + 1/4 = "1.25"

SeriesSum(5) => 1 + 1/4 + 1/7 + 1/10 + 1/13 = "1.57"



2018.03.19


#Find the missing letter


Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array.


You will always get an valid array. And it will be always exactly one letter be missing. The length of the array will always be at least 2.

The array will always contain letters in only one case.


Example:


['a','b','c','d','f'] -> 'e'

['O','Q','R','S'] -> 'P'


(Use the English alphabet with 26 letters!)


Have fun coding it and please don't forget to vote and rank this kata! :-)


I have also created other katas. Take a look if you enjoyed this kata!



매일 코딩을 하기위해서 이것 저것 해보다가 업무나 일상에서 떠오르는 문제는 한계가 있고

오일러를 몇개 풀어봤는데 코딩보다는 수학을 잘해야되는구나 싶어서..... 고민중에 추천 받은


Codewas


비슷한 사이트인 hackerrank도 알고 있었지만 입,출력을 직접 코딩하지 않아도 되는점이 참 맘에들어서 결정


목표 :  5문제/주 - 평일에 1문제씩 풀고 어려워서 못푼문제는 주말에 푼다.




온라인으로 본 채용 테스트 문제

문제 난이도 자체는 그렇게 어렵진 않았지만 문제가 영어여서 당황


팬그램이란? (그리스어: παν γράμμα 판 그람마[*], '모든 글자'라는 뜻)은 알파벳의 모든 글자들을 사용해서 만든 문장을 뜻하며,

'The quick brown fox jumps over the lazy dog' 와 같은 문장이 팬그램입니다.


목표 : 입력받은 문장이 팬그램인지 판별

소요 시간 : 10분



가챠 게임에 많은 돈을 꼴아박고 빡쳐서 만들어본 가중치 있는 랜덤 


목표 : 가중치 있는 랜덤 값 뽑기

소요시간 : 2시간




'매일매일개발' 카테고리의 다른 글

codewars #43 Counting Duplicates (6kyu)  (0) 2018.05.17
#3 PANGRAM  (0) 2018.03.08
#1 문자열 역순으로 출력하기  (0) 2018.03.07

작년에 면접을 보면서 라이브 코딩으로 화이트보드에 코딩

굉장히 쉬운문제라고 생각했는데 막상 화이트보드에 적으려니 IDE에 익숙해져서 당황을 

( 면접 이후 한동안 자동완성 기능을 사용 하지 않으려고 해봤지만,,, )


목표 : 스트링 역순 출력 "abc"->"cba"

소요시간 : 10분

		
// 내풀이
// reverse 메소드를 사용한 기억은 있는데, 정확한 사용법이 기억이 나지 않아서 급한대로 
// 문자열을 array 로 만들고 뒤에서부터 다시 더해줬다.

String str = "abc"
StringBuilder strb = new StringBuilder();
char [] temp = str.toCharArray();
for (int i = str.length()-1; i >= 0; i--) {
	strb.append(temp[i]);
}
System.err.println(strb.toString());
		
// StringBuilder 내장 메소드 사용
// 집에 오자마자 이클립스를 키고 자동완성 기능을 통해서 구현.
System.out.println(new StringBuffer(str).reverse().toString());


'매일매일개발' 카테고리의 다른 글

codewars #43 Counting Duplicates (6kyu)  (0) 2018.05.17
#3 PANGRAM  (0) 2018.03.08
#2 가챠 - 가중치가 있는 랜덤  (0) 2018.03.07

+ Recent posts