g2601_2700.s2667_create_hello_world_function.readme.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
The newest version!
2667\. Create Hello World Function
Easy
Write a function `createHelloWorld`. It should return a new function that always returns `"Hello World"`.
**Example 1:**
**Input:** args = []
**Output:** "Hello World"
**Explanation:**
const f = createHelloWorld();
f(); // "Hello World"
The function returned by createHelloWorld should always return "Hello World".
**Example 2:**
**Input:** args = [{},null,42]
**Output:** "Hello World"
**Explanation:**
const f = createHelloWorld();
f({}, null, 42); // "Hello World"
Any arguments could be passed to the function but it should still always return "Hello World".
**Constraints:**
* `0 <= args.length <= 10`
© 2015 - 2024 Weber Informatics LLC | Privacy Policy