Coding Problems
Coding Problems
Given a list of words, find all pairs of unique indices such that the concatenation of the two
words is a palindrome.
For example, given the list ["code", "edoc", "da", "d"], return [(0, 1), (1, 0), (2, 3)].
2. Implement a 2D iterator class. It will be initialized with an array of arrays, and should
implement the following methods:
● next(): returns the next element in the array of arrays. If there are no more elements,
raise an exception.
● has_next(): returns whether or not the iterator still has elements left.
For example, given the input [[1, 2], [3], [], [4, 5, 6]], calling next() repeatedly should output 1, 2,
3, 4, 5, 6.
3. Given an array of integers, return a new array where each element in the new array is the
number of smaller elements to the right of that element in the original input array.
For example, given the array [3, 4, 9, 6, 1], return [1, 1, 2, 1, 0], since:
4. Write a Rectangle class allowing you to build a rectangle with length and width
attributes.Create a Perimeter() method to calculate the perimeter of the rectangle
and a Area() method to calculate the area of the rectangle.Create a method display()
that display the length, width, perimeter and area of an object created using an
instantiation on rectangle class.Create a Parallelepipede child class inheriting from
the Rectangle class and with a height attribute and another Volume() method to
calculate the volume of the Parallelepiped.In the main function, make 10 objects of
Parallelepipede class and then display it on the screen as well as write its data in text
file in the following format:
Object No: 1
Height: ?
Length: ?
Width: ?
Area: ?
Volume:?
5.Create a Python class Person with attributes: name and age of type
string.Create a display() method that displays the name and age of an object
created via the Person class.Create a child class Student which inherits from
the Person class and which also has a section attribute.Create a method
displayStudent() that displays the name, age and section of an object
created via the Student class.Create a student object via an instantiation on
the Student class and then test the displayStudent method.You are provided
with “Person.csv” file.You have to read that file and take arguments name, age
and section from that file.