Walmart Coding interview

Posted
16 Jun 2026
97 reads

Summary

I completed a coding assessment for Walmart that included a problem about selecting models to meet feature requirements.

How it went

In recent Walmart Assessment

Problem Statement

You are given n machine learning models.

For each model:

  • cost[i] represents the cost of the i-th model.
  • featureAvailability[i] is a binary string of length 2 describing which features the model supports:
    • "00" → supports neither Feature A nor Feature B
    • "01" → supports only Feature B
    • "10" → supports only Feature A
    • "11" → supports both Feature A and Feature B

A set of selected models is said to be k-capable if:

  • The number of selected models that support Feature A is at least k.
  • The number of selected models that support Feature B is at least k.

Note that a model with feature availability "11" contributes to both counts.

For every integer k from 1 to n, determine the minimum total cost required to select a k-capable set of models.

If it is impossible to form a k-capable set, return -1 for that value of k.

Questions asked (1)

  1. 01

    Minimum Cost k-Capable Model Selection

    Data Structures & Algorithms

    Given n models each with a cost and a binary string of length 2 indicating support for Feature A and Feature B, find for every k (1 ≤ k ≤ n) the minimum total cost of a subset of models such that at least k models support Feature A and at least k models support Feature B. Models with "11" count toward both features. Return -1 for a particular k if no subset satisfies the requirement.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Walmart recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!