• Skip to primary navigation
  • Skip to content
  • Skip to footer
Xuanken's Space Xuanken's Space
  • About
  • Blog
  • Coding Exercises
  • Projects
    1. Home
    2. /
    3. Exercises
    4. /
    5. Fibonacci Subset Sum
    Xuanken Tay

    Xuanken Tay

    Software engineer who likes statistics, machine learning, DevOps and the cloud

    • Sydney, AU
    • GitHub
    • LinkedIn
    • Email

    Fibonacci Subset Sum

    June 15, 2022 less than 1 minute read

    Given an integer n, return the minimum number of Fibonacci numbers required to sum up to n.

    Constraints

    • 1 ≤ n < 2 ** 31

    https://binarysearch.com/problems/Fibonacci-Subset-Sum

    Examples

    Example 1

    Input

    • n = 9

    Output

    • answer = 2

    Explanation

    We can use the Fibonacci numbers [1, 8] to sum to 9.

    Solution

    Categories: exercises

    Updated: June 15, 2022

    Share on

    Twitter Facebook LinkedIn
    Previous Next

    Leave a comment

    Read more

    Hashicorp Certified: Vault Associate 002

    August 11, 2024 5 minute read

    How to prepare for the Vault Associate 002 exam.

    Helm: Migrate Releases from Helm 2 to Helm 3

    August 8, 2024 4 minute read

    How to migrate Helm 2 releases to Helm 3

    Kubernetes: Deployments

    May 11, 2024 2 minute read

    Ensuring reliable and up-to-date application deployment

    Anagram Substrings

    October 13, 2022 less than 1 minute read

    Given two strings s0 and s1, return the number of substrings where s1 contains any anagram of s0.

    • Follow:
    • GitHub
    • LinkedIn
    • Feed
    © 2024 Xuanken Tay. Powered by Jekyll & Minimal Mistakes.