FastPrepSum Elements at Even Indices
Problems/Sum Elements at Even Indices

Sum Elements at Even Indices

NatWest Group logoNatWest Group● EasyOA

Updated Nov 2026

QuestionFunctionExamples

Problem statement

You are given an integer array nums. Return the sum of the elements at even indices of the array.

Use standard zero-based indexing.

Function

sumEvenIndices(nums: int[]) → int

Examples

Example 1

nums = [4,1,7,3,2]return = 13

The even indices are 0, 2, and 4, so the sum is 4 + 7 + 2 = 13.

More NatWest Group Online Assessment questions

  • Remove Duplicate CharactersOA · Seen Jul 2026

Similar questions at other companies

  • Missing IntervalsIBM · OAIBM interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Two SumAmazon · OA · PHONE SCREEN
  • Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Server InvestmentRippling · OARippling interview questions
  • Book Reading EveningsGoogle · OAGoogle interview questions
See NatWest Group hiring insights
Saved
class Solution {
    public int sumEvenIndices(int[] nums) {
      // write your code here
    }
}
Checking account…