Rotate n x n matrix by 90 degrees

Problem You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). Another way to ask the same problem Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place? Examples Example 1: ...

Text Justification Problem

Problem Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. OR Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters. ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy