Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Coding: Remove Vowels and Reverse Array

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Coding: Remove Vowels and Reverse Array. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

A USAA Mobile app utility receives a text label and an array of numeric status codes. Implement one function that removes all English vowels from the text and reverses the array in place.

Treat a, e, i, o, and u as vowels, regardless of case. Preserve every other character, including spaces, punctuation, digits, and uppercase letters. The text's relative order must remain unchanged after vowel removal. Reverse the array without creating another array proportional to its length.

Formal Specification

Given a string text and a mutable list of integers nums, return a two-element list:

  1. The string produced by removing all vowels from text.
  2. The reversed nums list.

The reversal must be performed in place using swaps. The input string must not be modified, since Python strings are immutable.

Constraints

  • 0 <= len(text) <= 10^5
  • 0 <= len(nums) <= 10^5
  • -10^9 <= nums[i] <= 10^9
  • Only English vowels are removed
  • The array must be reversed in place

Function Signature

def process_usaa_inputs(text, nums):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output