Count numbers containing 4 Basic Accuracy: 48.18% Submissions: 2010 Points: 1 Count the numbers between 1 to N containing 4 as a digit. Example 1: Input: N = 9 Output: 1 Explanation: 4 is the only number between 1 to 9 which contains 4 as a digit. Example 2: Input: N = 14 Output: 2 Explanation: 4 and 14 are the only number between 1 to 14 that contains 4 as a digit. Your Task: You don't need to read input or print anything. Your task is to complete the function countNumberswith4() which takes an Integer N as input and returns the answer.
Posts
Showing posts from May, 2021
heck if array contains contiguous integers with duplicates allowed
- Get link
- X
- Other Apps
Easy Accuracy: 65.11% Submissions: 761 Points: 2 Given an array of n integers(duplicates allowed). Print “Yes” if it is a set of contiguous integers else print “No”. Example 1: รข€‹ Input : arr[ ] = {5, 2, 3, 6, 4, 4, 6, 6} Output : Yes Explanation: The elements of array form a contiguous set of integers which is {2, 3, 4, 5, 6} so the output is "Yes". Example 2: Input : arr[ ] = {10, 14, 10, 12, 12, 13, 15} Output : No Your Task: This is a function problem. The input is already taken care of by the driver code. You only need to complete the function areElementsContiguous() that takes an array (arr) , sizeOfArray (n) , and return the true if it is a set of contiguous integers else print false . The driver code takes care of the printing.
Delete without head pointer
- Get link
- X
- Other Apps
You are given a pointer/ reference to the node which is to be deleted from the linked list of N nodes. The task is to delete the node. Pointer/ reference to head node is not given. Note: No head reference is given to you. It is guaranteed that the node to be deleted is not a tail node in the linked list. Example 1: Input: N = 2 value[] = {1,2} node = 1 Output: 2 Explanation: After deleting 1 from the linked list, we have remaining nodes as 2. Example 2: Input: N = 4 value[] = {10,20,4,30} node = 20 Output: 10 4 30 Explanation: After deleting 20 from the linked list, we have remaining nodes as 10, 4 and 30. Your Task: You only need to complete the function deleteNode that takes reference to the node that needs to be deleted . The printing is done automatically by the driver code .