Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a function to normalize the values in a numeric vector between 0 and 1.

Medium

Problem Statement

Create a function to normalize the values in a numeric vector between 0 and 1.

Sample Input

Vector: c(10, 20, 30, 40, 50)

Sample Output

Normalized: 0 0.25 0.5 0.75 1

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure normalize <- function(vector) { # Your logic here } normalized_vector <- normalize(vector) print(paste("Normalized:", round(normalized_vector, 2)))
Log in or sign up to run or submit your code.Log inSign up
Input
Vector: c(10, 20, 30, 40, 50)
Expected Output
Normalized: 0 0.25 0.5 0.75 1