write the program with the language NODEJS need help Programming challenge, screenshot your work and output.
Description
A positive integer is a palindrome if its decimal representation (without leading zeros, is a palindromic string (a string that reads the same forwards and backwards). For example, the number 5, 77, 363, 4884, 11111, 12121 and 349943 are palindromes
A range of integers is interesting if it contains an even number of palindromes. The range [L, R], with L <= R, is defined as the sequence of integers from L to R (inclusive): (L, L+1, L+2,.., R-1, R). L and R are the range’s first and last numbers.
The range [L1,R1] is subrange of [L,R] if L <= L1 <= R1 <= R. Your job is to determine how many interesting subrane of [L,R] there are
Input
Your program should read lines of text from standard input. Each line will contain two positive integers, L and R (in that Order), separated by space.
Output
For each line of input, print out the number of interesting subranges of [L,R]
Code given:
process.stdin.resume();
process.stdin.setEncoding('utf8');
var stdin = ' ';
process.stdin.on('data', function (chunk) {
stdin += chunk;
}).on('end', function() {
var lines = stdin.trim().split('\n');
for(var i=0; i
process.stdout.write(lines[i]);
}
});
Here is one way to do it: (Copyable code is provided at the end)
Driver Function:

Main function: This Function counts the number of palindromes

Palindrome checker Function : This Function checks whether a number is palindrome or not.

Input: First line for the number of inputs and the second line for the values L and R.

Output:

Copyable code:
function main(chunk) {
var input = chunk.trim().split(' ');
for (var i = 1; i < input.length; i++) {
var splitchunk = input[i].split("
");
var begin =
parseInt(splitchunk[0]);
var end =
parseInt(splitchunk[1]);
var count = 0;
for (var j = begin; j <= end;
j++) {
if
(isPalindrome(j.toString())) {
count++;
}
}
console.log(count);
}
}
function isPalindrome(chunk) {
var midIndex = Math.floor(chunk.length / 2);
var len = chunk.length;
var isPalindrome = true;
for (var i=0 ; i <= midIndex ; i++) {
if (chunk[i] != chunk[len-(i+1)]) {
isPalindrome =
false;
break;
}
}
return isPalindrome;
}
process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin = "";
process.stdin.on("data", function (chunk) {
stdin += chunk;
});
process.stdin.on("end", function () {
main(stdin);
});
write the program with the language NODEJS need help Programming challenge, screenshot your work and output. ...
I really need help with the code for this, in C++ please, I know there's a similar question but the answer isn't correct :[ A palindrome is a string that reads the same forwards and backwards (ignoring spaces, punctuation, and capitalization). Examples are the familiar ``If I had a hi-fi,'' the grander ``A man, a plan, a canal, Panama,'' and ``Some men interpret nine memos.'' So the goal: Design, implement, document, and test a program that reads a line of...
I need help programming this program in C. 1.) Write a program that reads a message, then checks whether it's a palindrome (the letters in the message are the same from left to right as from right to left), example is shown below: Enter a message: He lived as a devil, eh? Palindrome Enter a message: Madam, I am Adam. Not a Palindrome 2.) Ignore all characters that aren't letters. Use integer variables to keep track of positions in the...
C Programming Language only please. Your help is greatly
appreciated. Will give thumbs up for quality work.
Lab 8 (this is to be turned in) Palindrome is a string that is the same as backwards or forwards “otto” “ababa” “noon” “ababbbbaba” In this lab we will work with strings (so we will be using character arrays). 1. Write a program that reads two strings strl and str2 from the keyboard 2. Print both strings 3. Write a function computeLength and...
Write the code in python programming Language String Statistics: Write a program that reads a string from the user and displays the following information about the string: (a) the length of the string, (b) a histogram detailing the number of occurrences of each vowel in the string (details provided below), (c) the number of times the first character of the string occurs throughout the entire string, (d) the number of times the last character of the string occurs throughout the...
write the solution of the program by python 3 language : I need the program using list : You are given a sequence of n positive integers a1,a2,…,an, where n is even. Swap adjacent elements in the given sequence and print the resulting sequence: a2,a1,a4,a3,a6,a5,… Input The first line contains a positive even integer n (2≤n≤1000) — the length of the sequence. The second line contains n space-separated integers a1,a2,…,an (1≤ai≤1000) — the elements of the sequence. Output Print n...
write the solution of the program by python 3 language : I need the program using list : You are given a non-decreasing sequence of n positive integers a1,a2,…,an. Print the number of distinct values in the sequence. For example, if the sequence is 1,2,2,2,3,4,4,5,7,10, the answer is 6 since distinct values are 1,2,3,4,5,7,10. Input The first line contains a positive integer n (1≤n≤1000) — the length of the sequence. The second line contains n space-separated positive integers a1,a2,…,an (1≤ai≤1000)...
I need help writing these 2 programs please include all the indents :) In this programming challenge you are to create two Python programs: randomwrite.py andrandomread.py. One program, randomwrite.py, is to write a set of random numbers to a file. The second program, randomread.py, is to read a set of random numbers from a file, counts how many were read, displays the random numbers, and displays the total count of random numbers. Random Number File Writer (randomwrite.py) Create a program...
write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : i have 15 min to submit the solution please help me You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other...
write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...
(C++ programming) Need help with homework. Write a program that can be used to gather statistical data about the number of hours per week college students play video games. The program should perform the following steps: 1). Read data from the input file into a dynamically allocated array. The first number in the input file, n, represents the number of students that were surveyed. First read this number then use it to dynamically allocate an array of n integers. On...