CiscoDevNet2

in collaboration with

presents

The Legendary Cisco Back-To-School Coding Game!

Back-to-School? YEEEY.

But first, let's have one more spin on one of the cool games.

Let's see how you deal with 3D Twister!

Grand Prize

Amazon Voucher Worth
€ 25

DevNet users special prize

+250€ to the main prize if you have Cisco DevNet account! (Add your DevNet User ID during the registration process)

---> Not a DevNet user yet? Create your account for free now! <---

Amazon Voucher Worth
€ 50

BRIEF

3D Twister!

 

Sam is developing a version of the game of 3-D twister, where the cells on the mat have to be painted in three colors: Red, Blue, and Green. The mat is a 2-dimensional grid of size 3 x n. Sam wants to know how many different mats he can make, painting the cells in three colors, Red, Blue, and Green such that:

The n cells of a single row are not all the same color.
The 3 cells of a single column are not all the same color.

For example, given n=2, there are 174 valid ways to paint the mat. Some of them are as shown in the image below:

cisco twister

Compute the number of ways in which Sam can paint the mat!

Function Description

Complete the twisterMat function in the editor below. The function must return an integer denoting the number of ways in which Sam can paint the given grid. The result should be calculated as a mod of 109+7.

twisterMat has only one parameter:

n: An integer, denoting the number of columns of the mat.

For the full description and constraints please sign up or sign in with your Codemotion account below!

 

Keywords: Coding, Dynamic Programming, MEDIUM difficulty, Algorithms, Problem Solving, Implementation, Core CS, Core Skills

 

Code. Fun. Repeat.

Sign Up And Code Yourself To The Top

BY SIGNING UP TO THE CISCO CODING CHALLENGE YOU DECLARE THAT YOU HAVE READ AND AGREE TO THE TERMS AND CONDITIONS OF THIS CODING CHALLENGE.

Cisco DevNet is Cisco's developer program to help developers and IT professionals who want to write applications and develop integrations with Cisco products, platforms, and APIs. Cisco DevNet includes Cisco's products in software-defined networking, security, cloud, data center, internet of things, collaboration, and open-source software development. The developer.cisco.com site also provides learning and sandbox environments as well as a video series for those trying to learn coding and testing apps.

Codemotion.com deliver high-quality content to over 350,000 software developers all across Europe each day. Derived from our Online and Offline events we offer companies a unique opportunity to engage with a well-segmented, active and curious community of software developers and IT professionals.

The Codemotion Platform and the annual Conferences cover these tracks and interests on a multi-channel basis: Devops, Blockchain, AI/Machine Learning, Inspirational, GameDev, IoT Big Data, Front-end, Cloud, Cybersecurity, Serverless, Software Architecture, AR/MR/VR, Design, UX.

We love what we do and we are very good at what we do. If you would like to work in our Team, please visit our career page for open positions.

© 2019 | CODEMOTION | IVA IT12392791005 info@codemotion.it

PRIVACY POLICY.

The Terms and Conditions of the coding challenge can be read and downloaded from here. The prizes can under no circumstance be converted into cash. Codemotion reserves the right to change any and all terms of her promotions without prior notification.