Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a Go program to demonstrate the use of a custom struct as a key in a map.

Medium

Problem Statement

Write a Go program to demonstrate the use of a custom struct as a key in a map.

Sample Input

Struct Point with fields X and Y.

Sample Output

Point A
Point B

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" type Point struct { // Define fields for the struct } func main() { // Use the struct as a map key }
Log in or sign up to run or submit your code.Log inSign up
Input
Struct Point with fields X and Y.
Expected Output
Point A
Point B