Skip to main content

Start Coding

Problem​

When learning a new language, we first learn to output some message. Here, we'll start with the famous Hello World message. Now, here you are given a function to complete. Don't worry about the input and output of functions, just print "Hello World" message

Examples:​

Example 1:

Input: No input
Output: Hello World

Your task:​

Your task is to complete the function printHello() that prints Hello World.

  • Expected Time Complexity: O(1)O(1)
  • Expected Auxiliary Space: O(1)O(1)

Solution​

Python​

def printHello(self) -> None:
print("Hello World")

Java​

public static void printHello() {
System.out.println("Hello World");
}

C++​

void printHello() {
cout<<"Hello World";
}

C​

void printHello() {
printf("Hello World\n");
}
  • Time Complexity: O(1)O(1)
  • Auxiliary Space: O(1)O(1)