!!! CODE WARS - JULY!!!
*NOTE - ALL STUDENTS FROM FSR AND DS have to attempt these questions and solve them in Python (DS STUDENTS) and JavaScript (FSR STUDENTS)!!!
Question 1 Easy:
Given an integer array Arr[] of size N. The task is to find sum of it.
Example 1:
Input:N = 4Arr[] = {1, 2, 3, 4}Output: 10Explanation: 1 + 2 + 3 + 4 = 10.
Example 2:
Input:N = 3Arr[] = {1, 3, 3}Output: 7Explanation: 1 + 3 + 3 = 7.
Your Task:
Complete the function sum() which takes array arr and single integer n, as input parameters and returns an integer denoting the answer. You don’t to print answer or take inputs.
Question 2 Medium:
Given a number N.Find if the digit sum(or sum of digits) of N is a Palindrome number or not.
Note:A Palindrome number is a number which stays the same when reversed.Example- 121,131,7 etc.
Example 1:
Input:N=56Output:1Explanation:The digit sum of 56 is 5+6=11.Since, 11 is a palindrome number.Thus,answer is 1.
Example 2:
Input:N=98Output:0Explanation:The digit sum of 98 is 9+8=17.Since 17 is not a palindrome,thus, answeris 0.
Your Task:
You don’t need to read input or print anything.Your Task is to complete the function isDigitSumPalindrome() which takes a number N as input parameter and returns 1 if the Digit sum of N is a palindrome.Otherwise it returns 0.
Question 3 Medium:
Given an integer, check whether it is a palindrome or not.
Example 1:
Input: n = 555Output: Yes
Example 2:
Input: n = 123Output: No
Your Task:
You don’t need to read or print anything. Your task is to complete the function is_palindrome() which takes the number as input parameter and returns “Yes” if it is palindrome otherwise returns “No”(Without quotes).