Recently, our team helped several students conduct several NVIDIA In OA and Coding interviews, the probability of actually encountering the following questions is very high, especially for AI Engineer, CUDA-related development and system software positions. NVIDIA's coding questions are increasingly focusing on bit operation optimization, mathematical enumeration and efficient data structures. Here are 5 high-frequency NVIDIA OA Questions. It is recommended that you focus on these questions, which can basically cover the recent OA and Onsite Coding.

Topic 1: Statistics of Ideal Numbers
Question description
Ideal number definition: The prime factors of positive integers only include 3 and 5, which can be expressed as 3x×5y (x, y are non-negative integers). For example, 15, 45, and 75 are ideal numbers, but 6, 10, and 21 are not.
Need: Given a range [low, high], count the number of ideal numbers within the range.
Example: There are 4 ideal numbers in the range [200,405]: 32×52=225, 35×50=243, 31×53=375, 34×51=405.
Function requirements
- Function name:
GetIdealNums - Parameter:
Low(lower range, inclusive),High(upper range, inclusive), both integers - Return value: the number of ideal numbers in the range (integer)
Core idea:
We already know that the ideal number is 3^x*5^y times, because 3^x and 5^y times, the number of times here is at most log. We can violently enumerate how many 3s and how many 5s are multiplied, and then judge whether they are within this interval, and if so, add them up.
Question 2: Restore the original array from the prefix XOR array
Question description
Prefix XOR definition: for an array of non-negative integers Arr[n], the prefix XOR of position i Pref[i] = arr[1] ⊕ arr[2] ⊕ ... ⊕ arr[i](⊕ Is a bitwise XOR operation).
Need: known prefix XOR array Pref, restore the original array Arr.
Example:like Pref = [5, 2, 10], then the original array Arr = [5, 7, 8](Derivation: arr[1]=pref[1]=5; arr[2]=pref[1]⊕pref[2]=5⊕2=7; arr[3]=pref[2]⊕pref[3]=2⊕10=8).
Sample input:Pref = [2, 2, 5, 6](length 4)
Function requirements
- Function name:
GetOriginalArray - Parameter:
Pref(array of integers) - Return value: original array after restoration (integer array)
- Constraints: 1≤n≤105, 0≤pref[i]≤109
Core idea:
The given formula is the sequence c, and the original sequence is a. The given c1=a1 c2=a1 xor a2 c3=a1 xor a2 xor a3. By analogy, the original array restored is a1=c1 a2=c1 xor x2=a1 xor a1
Question 3: Determine the same 4K page address
Question description
Need: Write a function to determine whether the memory addresses of two 32-bit systems are on the same 4K page boundary. The 4K page size is 4096 bytes, and the address of the same page satisfies Addr // 4096 The result is the same.
Example: Input addresses 4095 and 4094, both of which belong to page 0 (4095//4096=0, 4094//4096=0), output True(or 1).
Function requirements
- Function name:
SamePage - Parameter:
Addr1,Addr2(integer, 32-bit address) - Return value: Return to the same page
True/1, return to different pagesFalse/0
Core idea:
- Remove the lower 12 bits of the address (intra-page offset)
- Compare page numbers for consistency
(addr1 & ~0xFFF) == (addr2 & ~0xFFF)
Essence: bit operations + memory alignment knowledge
Question 4: Generate a specified bit mask (BitMask)
Question description
Need:Write a function and input two integers Hi(high position),Lo(low bits), generates a bit mask under 32-bit systems (binary Lo Arrive Hi Bit is 1 and the rest are 0) and returned as a string (e.g. 0x7 Represents binary 111).
Example:enter Hi=2,Lo=0, the generated mask binary is 111, output string 0x7.
Function requirements
- Function name:
SetMask - Parameter:
Hi(high bit, integer),Lo(low bit, integer) - Return value: String representation of bit mask (format is as follows
0x...) - Constraints: Design masks based on 32-bit systems
Core idea:
((1 << (hi + 1)) - 1) & ~((1 << lo) - 1)
Key points:
- First half: generate [0, hi] all 1
- Second half: remove [0, lo-1]
Nature:Bitmask construction + boundary processing
Question 5: Maximum Score
Question description
Given an integer array of length n Arr, the initial score is 0. At each step, an element in the array is selected, its value is added to the score, and the element is replaced with the rounded-up third of its value.
The task is to perform this operation k times and find the maximum possible score that can be obtained.
Example
- Input: n=5,arr=[20,4,3,1,9],k=4
- Optimal steps:
- Choose 20 → Score + 20, 20 becomes ⌈20/3⌉=7
- Choose 7 → Score + 7, 7 becomes ⌈7/3⌉=3
- Choose 4 → Score + 4, 4 becomes ⌈4/3⌉=2
- Choose 9 → Score + 9, 9 becomes ⌈9/3⌉=3
- Final score: 20+7+4+9=40
Sample input and output
- Input: n=4,arr=[4,5,18,1],k=3
- Optimal steps:
- Choose 5 → Score = 5, 5 becomes ⌈5/3⌉=2
- Choose 18 → Score = 5+18=23, 18 becomes ⌈18/3⌉=6
- Pick 6 → Score = 23+6=29, 6 becomes ⌈6/3⌉=2
- Output: 29
Function requirements
- Function name:
GetMaximumScore - Parameter:
Arr: Integer array (1≤n≤105, 1≤arr[i]≤109)K:Number of operations (1≤k≤105)
- Return value: Maximum score after k operations (integer)
Core idea:
- Use max heap
- Take the maximum each time → update → put back
Val = (val + 2) // 3
Nature:
- Greedy strategy
- Priority queue (heap)
Preparing for the NVIDIA exam is too confusing? If you can't bear it alone, come to me.
If you need the complete Python/C++ code for these 5 questions, or more recent NVIDIA OA/Onsite real questions (including system design), please feel free to message me directly. I will personally help you evaluate and provide targeted information. ProgramHelp continues to help students compete with major companies such as NVIDIA, Microsoft, and Google, and their results can be checked. Need OA assistance , VO ideas assistance or full-process support for students, please come to me at any time.
Come on! Get the NVIDIA Offer early!