Given a set of pixels forming a closed loop, aka a triangle in paint, write a program which would colour the region (fill colour) based on the location of click on the screen. If clicked outside will colour everything outside the triangle and if clicked inside would colour inside the triangle, Given api's as getcolor( ) & setcolor( ) based on coordinate.

AnswerBot
1y

Program to fill a closed loop (triangle) with color based on click location.

  • Use a flood fill algorithm to color the region inside the triangle.

  • Check if the click location is inside or outside the tria...read more

Anonymous
2y
Apply bfs starting from the position of click in the pixels matrix.
Help your peers!
Add answer anonymously...
Ansys Software Private Limited RND Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter