PracHub
QuestionsLearningGuidesInterview Prep

Quick Overview

This question evaluates a candidate's understanding and practical implementation skills for instance-based supervised learning, specifically the k-nearest neighbors algorithm, covering distance metrics, neighbor selection, majority voting and tie-breaking, feature scaling effects, time complexity, and model selection considerations like k and weighting. It is commonly asked to assess both conceptual grasp of non-parametric classification and practical coding ability to implement and analyze algorithms, and it falls under coding & algorithms and machine learning domains with a mix of conceptual understanding and practical application.

  • medium
  • J.P. Morgan
  • Coding & Algorithms
  • Data Scientist

Implement KNN from Scratch

Company: J.P. Morgan

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Quick Answer: This question evaluates a candidate's understanding and practical implementation skills for instance-based supervised learning, specifically the k-nearest neighbors algorithm, covering distance metrics, neighbor selection, majority voting and tie-breaking, feature scaling effects, time complexity, and model selection considerations like k and weighting. It is commonly asked to assess both conceptual grasp of non-parametric classification and practical coding ability to implement and analyze algorithms, and it falls under coding & algorithms and machine learning domains with a mix of conceptual understanding and practical application.

Last updated: Apr 19, 2026
Loading…
PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Two Sum — Indices Summing to a Target - J.P. Morgan (medium)
  • First Non-Repeating Character in a String - J.P. Morgan (medium)
  • Shift Non-Zero Elements Left In Place - J.P. Morgan (medium)
  • Can All Courses Be Completed? - J.P. Morgan (medium)
  • Merge Overlapping Intervals - J.P. Morgan (medium)