Search Results


10 matches found for 'colors'

Paint adjacent boundaries with distinct colors

... assignment where I had to write some code that will paint the countries of Africa with distinct colors. For the colors, I was given a domain of set(['red','blue','white','yellow','green']).


Flip adjacent colors in a 2D matrix

Problem Given a 2D array of black-and-white points and an entry point, flip the color of all points connected to the entry point (including the entry point itself). Input A: 2D boolean array of size greater than \(n\) \times \(m\), where False represents the color black and True represents the color white.


Escape from the Strings

What is escaping? Escaping is used for characters that are not intended to be shown. Consider the following text: <strong>Hi there</strong> This text is saved onto a HTML file, foo.


How to convert a PPM image to grayscale in C++

What is PPM? PPM is simply an image format that is very easy to work with, for modifying purposes. We'll create this image format from scratch, using C++. PPM Images can be opened with IfranView. Step 1 - The class for PPM image First, let's define a class for this PPM image.


HTML and CSS Concepts

... a browser engine to paint elements of a page with decorative features, like positioning and colors. CSS features are defined with declaration blocks. Example: h2 { // This is a declaration block .


Machine Learning Basics

... categorical data doesn't have a lot of meaning when converted to numbers. For example, assigning colors red = 1, blue = 2, and green = 3 doesn't really have much meaning across varying applications.


Algorithm Interview Problems

... Heaps Merge k sorted lists Graphs Find a path in a maze from start to finish Flip colors in a matrix Search Search in a rotated sorted array Find the Duplicate Number Greedy Algorithms Queue Reconstruction By Height Trie Build a Trie in Python Invariant Compute the max.


A guide to const in C++

The Many Uses of const with Operator Overloading const can be used in different ways depending on how an operator is overloaded. There are two major cases to consider: If an operator is overloaded as a nonmember function (not part of the class definition) If an operator is overloaded as a member function (part of the class definition) Case 1: Overloaded as a Nonmember Function Here is an example of the + operator overloaded as a nonmember function: const Weight operator +(const Weight& w1, const Weight& w2); Notice we have three positions where we can place const and each one means something different.


Data stores in Software Architectures

Use Cases There are many ways to store your data. In this article we'll walk through some examples of data storage in common system designs. Reminder: There is no single best storage choice and they may vary heavily depending on things such as access patterns and scale.


Algorithm Handbook

Introduction Welcome to the algorithm handbook wiki! In this wiki you will find a mini-cheat sheet overview of data structures, and examples of their usages in modern languages. Algorithm problems can be found here.