Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      81 of 114

      Zoom in

      Zooming into a photo spreads its pixels apart, and every new pixel between them needs a brightness. Write between(square, fx, fy): given the 4 old pixels around a new one (square, 2 × 2) and how far the new pixel sits across (fx, 0 at the left pixels, 1 at the right ones) and down (fy, 0 at the top, 1 at the bottom), return its brightness.

      A handwritten 7, 8 × 8 pixels, zoomed in 4×. Copying the nearest pixel only makes the same blocks bigger. The goal is a zoom where the brightness slides smoothly from pixel to pixel, like the one it ends on. Your between() gets the 4 old pixels around a new one and where it sits between them.

      A tiny photo: a handwritten 7, 8 × 8 pixels, each 0 (dark) to 16 (bright).the photozoomed in 4×
      Your functionbetween(square, fx, fy)
      squarethe 4 old pixels around the new one (a 2x2 numpy array): square[0] the top two, square[1] the bottom twoe.g. [[0, 0], [0, 16]]
      fxhow far across the new pixel sits, 0 at the left pixels to 1 at the right onese.g. 0
      fyhow far down it sits, 0 at the top pixels to 1 at the bottom onese.g. 0
      returnsthe new pixel's brightness
      solution.pyLoading Python
      Sign in for an AI hint
      ← Find the edgesFix the colors →