본문 바로가기

전체 글54

[Codewars] Find The Parity Outlier Q. You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. Examples.[2, 4, 0, 100, 4, 11, 2602, 36] -->  11 (the only odd number)[160, 3, .. 2024. 6. 9.
[Codewars] You're a square! Q. You like building blocks. You especially like building blocks that are squares. And what you even like more, is to arrange them into a square of square building blocks!However, sometimes, you can't arrange them into a square. Instead, you end up with an ordinary rectangle! Those blasted things! If you just had a way to know, whether you're currently working in vain… Wait! That's it! You just .. 2024. 6. 9.
[Codewars] Stop gninnipS My sdroW! Q. Write a function that takes in a string of one or more words, and returns the same string, but with all words that have five or more letters reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present. "Hey fellow warriors"  --> "Hey wollef sroirraw" "This is a test        --> "This is a.. 2024. 6. 8.
[Codewars] Multiples of 3 or 5 Q. If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.Additionally, if the number is negative, return 0.Note: If the number is a multiple of both 3 and 5, only count it once. S.int solution(int n) { int result = 0;.. 2024. 6. 6.