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

Programming Exercises

Write a function to compute the mode of a numeric vector.

Medium

Problem Statement

Write a function to compute the mode of a numeric vector.

Sample Input

Vector: c(1, 2, 2, 3, 3, 3, 4, 4, 5)

Sample Output

Mode: 3

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure find_mode <- function(vector) { # Your logic here } result <- find_mode(vector) print(paste("Mode:", result))
Log in or sign up to run or submit your code.Log inSign up
Input
Vector: c(1, 2, 2, 3, 3, 3, 4, 4, 5)
Expected Output
Mode: 3