We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Beautiful Days at the Movies
Beautiful Days at the Movies
Sort by
recency
|
1769 Discussions
|
Please Login in order to post a comment
def beautifulDays(i, j, k): count = 0 for r in range(i,j+1): str1 = str(r) rev_str = str1[::-1] rev_num = int(rev_str) diff = abs(r-rev_num) num = diff/k num1 = diff//k if num == num1: count += 1 return count
my very easy cpp solution
int beautifulDays(int i, int j, int k) {
}
my very easy cpp solution
int beautifulDays(int i, int j, int k) {
}
Here is my solution in JavaScript:
` let count = 0
for(let n = i; n <= j; n++){
const reversed = parseInt(n.toString().split('').reverse().join(''), 10);
const diff = Math.abs(n - reversed);
}
return count; `
Here is problem solution in Python, Java, C++, C and javascript - https://programmingoneonone.com/hackerrank-beautiful-days-at-the-movies-problem-solution.html