content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Fast RTPS: Class Me... | __label__POS | 0.950161 |
# Week 2 Additional Resources
## Learning Objectives
* Objects
* Label variables as either Primitive vs. Reference.
* Identify when to use dot notation (`.`) vs. bracket notation (`[]`) when \
accessing values of an object.
* Use the `obj[key] !== undefined` pattern to check if a given variable that \
conta... | __label__POS | 0.994551 |
package pack
import (
"net/http"
"strings"
"time"
"github.com/appist/appy/support"
)
func mdwReqLogger(config *support.Config, logger *support.Logger) HandlerFunc {
return func(c *Context) {
requestID, _ := c.Get(mdwReqIDCtxKey.String())
start := time.Now()
c.Next()
r := c.Request
scheme := "http"
... | __label__POS | 0.696469 |
package pack
import (
"io"
"net/http"
"os"
"testing"
"github.com/appist/appy/mailer"
"github.com/appist/appy/support"
)
func newServer() *Server {
support.Build = support.ReleaseBuild
defer func() {
support.Build = support.DebugBuild
}()
asset := support.NewAsset(http.Dir("testdata/context"), "testdata/... | __label__POS | 0.917721 |
# Week 1 Additional Resources
## Learning Objectives
* Problem Solving
* Craft a clear, concise coding question to a more experienced developer.
* Research unknown JavaScript code syntax using MDN.
* Identify and fix a bug in code based on an error message.
* Manage your time and stress at App Academy.
* Expr... | __label__POS | 0.998911 |
## Behavioral Questions
* Tell me about yourself. What makes you a good fit for a full stack developer job at Uber?
* What is your greatest weakness as a software developer, and what are you doing to overcome that weakness?
## Trivia
* [What happens when you type in Google.com and hit enter?](https://github.com/alex... | __label__POS | 0.979127 |
## Behavioral
* Tell me about yourself
* What three things are you working on to improve your overall effectiveness?
* You have been assigned to a project in a new technology you haven’t worked with before. How do you get started? Have you ever done this before? How did it go?
## Easy
Given an array of length N, wit... | __label__POS | 0.995189 |
# Question \#1
## Find Missing Number
You are given an **unsorted** array, and are told that this array contains (n - 1) of n consecutive numbers (where the bounds are defined). Write a method, `findMissingNumber`, that finds the missing number in `O(N)` time
**Example:**
```js
// arrayOfIntegers: [2, 5, 1, 4, 9, 6, ... | __label__POS | 0.907666 |
# Partner A asks partner B
## Problem 1
### Jewels and Stones
You are given two strings, `J` and `S`. String `J` represents the types of stones that are jewels. String `S` represents all of the stones that you have. Each character in string `S` is a type of stone you have. You want to know how many of your stones ar... | __label__POS | 0.994376 |
# Question \#1
## Silly Sum
Write a method, `sillySum`, that takes in a sequence of digits as a string and returns the sum of all digits that match the **_next_** digit in the list. The list is "circular", so the digit after the last digit is the *first* digit in the list.
**Examples:**
- `1122` produces a sum of `3... | __label__POS | 0.99696 |
# Partner A Asks Partner B
### Shortest Distance Between Nodes
Write a method, `shortestDistance`, that takes in a `root` node and two node _values_. This method should return the shortest distance between these two nodes.
**Example:**
```
5
/ \
2 7
/ \ / \
1 4 6 11
/ \
3 ... | __label__POS | 0.996468 |
## High Score
(Question and solution taken from Interview Cake)
You've created an extremely popular game. You rank players in the game from highest to lowest score. So far you're using an algorithm that sorts in O(nlogn) time, but players are complaining that their rankings aren't updated fast enough. You need a faster... | __label__POS | 0.996103 |
## Behavioral
* Tell me about yourself
* What are some of your professional development goals?
* Tell me about a goal that you set that took a long time to achieve or that you are still working towards. How do you keep focused on the goal given the other priorities you have?
## Easy
Initially, there is a Robot at po... | __label__POS | 0.993535 |
# Partner B asks Partner A
## Problem 1
### Isomorphic Strings
**Overview:** For two strings to be isomorphic, all occurrences of a character in string `A` can be replaced with another character
to get string `B`. The order of the characters must be preserved. There must be one-to-one mapping for every char of
strin... | __label__POS | 0.988141 |
# Intersecting Arrays
Find the intersection of two arrays. An intersection would be the common elements that exists within both arrays. In this case, these elements should be unique!
**Example:**
```js
const firstArray = [2, 2, 4, 1];
const secondArray = [1, 2, 0, 2];
intersection(firstArray, secondArray); // Outpu... | __label__POS | 0.997226 |
## Behavioral
* Describe a situation in which you met a major obstacle in order to complete a project. How did you deal with it? What steps did you take?
* Tell me about a time you had to work on several projects at once. How did you handle this?
* Give an example of a time when you didn’t agree with other programmer.... | __label__POS | 0.99547 |
let names = ['mark', 'john', 'todd', 'anthony', 'david'];
let myFilter = (array, callback) =>{
let newArray = [];
for (const element of array) {
if(callback(element) === true)
newArray.push(element)
}
return newArray;
}
let myResult = myFilter(names, name => name.includes("o"));... | __label__POS | 0.738667 |
package pack
import (
"compress/gzip"
"fmt"
"io/ioutil"
"net/http"
"path/filepath"
"strings"
"sync"
"github.com/appist/appy/support"
"github.com/gin-gonic/gin"
)
type gzipHandler struct {
config *support.Config
excludedExts map[string]bool
pool sync.Pool
}
func mdwGzip(config *support.Conf... | __label__POS | 0.796054 |
## Behavioral
* Tell me about a time when you had a disagreement with other programmer. How did you handle the situation? Were you able to reach a mutually beneficial resolution to that conflict? If not, why were you and your co-worker unable to reach a mutually beneficial resolution? If you knew then what you know no... | __label__POS | 0.910992 |
# Triple Maximum
Given an array of integers, find the largest product yielded from three of the integers.
**Examples:**
```js
maxOfThree([10, 3, 5, 6, 20]) // Output: 1200. Multiply 10, 6, 20
maxOfThree([-10, -3, -5, -6, -20]) // Output: -90
maxOfThree([1, -4, 3, -6, 7, 0]) // Output: 168
```
**Hints:**
* Remind ... | __label__POS | 0.989196 |
# Partner A Interviews Partner B
## Easy
#### Pt. 1)
Oh no! Somebody added a click handler to the top level of your webpage (`document`) that closes the browser window on `click` ☹️. There is no way for us to remove this event listener, but good thing we are DOM Wizards! Instead of allowing this event to fire, we wa... | __label__POS | 0.783441 |
// Code generated by mockery v1.1.2. DO NOT EDIT.
package mock
import (
context "context"
record "github.com/appist/appy/record"
mock "github.com/stretchr/testify/mock"
sql "database/sql"
)
// Model is an autogenerated mock type for the Modeler type
type Model struct {
mock.Mock
}
// All provides a mock func... | __label__POS | 0.985696 |
// Code generated by mockery v1.1.2. DO NOT EDIT.
package mock
import (
context "context"
driver "database/sql/driver"
mock "github.com/stretchr/testify/mock"
record "github.com/appist/appy/record"
sql "database/sql"
time "time"
)
// DB is an autogenerated mock type for the DBer type
type DB struct {
mock... | __label__POS | 0.91589 |
// Code generated by mockery v1.1.2. DO NOT EDIT.
package mock
import (
context "context"
record "github.com/appist/appy/record"
mock "github.com/stretchr/testify/mock"
sql "database/sql"
)
// Stmt is an autogenerated mock type for the Stmter type
type Stmt struct {
mock.Mock
}
// Exec provides a mock functi... | __label__POS | 0.668156 |
// Code generated by mockery v1.1.2. DO NOT EDIT.
package mock
import (
context "context"
record "github.com/appist/appy/record"
mock "github.com/stretchr/testify/mock"
sql "database/sql"
)
// Tx is an autogenerated mock type for the Txer type
type Tx struct {
mock.Mock
}
// Commit provides a mock function w... | __label__POS | 0.862683 |
/**************DO NOT MODIFY THIS LINE BELOW*****************/
const fruits = require('../fruit-data')
/* 07. `addKeyAndValueToAll()` - Return the fruits array, adding the given key and
value to each fruit object
console.log(addKeyAndValueToAll(fruits, "inStock", true));
// returns array of 31 fruits, and each fruit ... | __label__POS | 0.852273 |
/**************DO NOT MODIFY THIS LINE BELOW*****************/
const fruits = require('../fruit-data')
/* 01. `firstFruitObject()` - Return the first object in the fruits array
console.log(firstFruitObject(fruits));
// { genus: 'Malus', name: 'Apple', id: 6, family: 'Rosaceae', order:
// 'Rosales', nutritions: { carb... | __label__POS | 0.605575 |
/***********************************************************************
Write a function named interrupter that accepts a single parameter `interruptingWord`:
`interrupter(interruptingWord)`
The interrupter function should return a function.
When the function returned by interrupter is called with a sentence,
the ... | __label__POS | 0.947471 |
/***********************************************************************
For this problem you will be writing a function capable of finding the volume
for a rectangle (height * width * length). In order to enter the
required measurements we'll need to measure them one at a time.
Write a function named `recVolume(heigh... | __label__POS | 0.983262 |
/***********************************************************************
Write a function named: coinCollector(numCoins). The coinCollector function will
accept a number of coins (greater that 0) to collect when it is first invoked
and will return a function. The function returned by coinCollector can then be
invoked n... | __label__POS | 0.990002 |
/***********************************************************************
Write a function named: countDownTimer(n). This function will represent a count
down of days till the New Year. The countDownTimer function will
take in a number argument (n) the first time it is called and if that
number is greater than 0 the co... | __label__POS | 0.995929 |
/***********************************************************************
Currying is the process of decomposing a function that takes multiple arguments
into one that takes single arguments successively until it has the sufficient
number of arguments to run.This technique is named after the
logician Haskell Curry(the ... | __label__POS | 0.900694 |
/***********************************************************************
Write a function using fat arrow syntax named `arrowMyMap` that accepts an array
and a callback as arguments. The function will return an array of new elements
obtained by calling the callback on each element of the array, passing in the
element.... | __label__POS | 0.763134 |
/******************************************************************************
Write a function named plannedIntersect(firstArr) that takes in an array and
returns a function. When the function returned by plannedIntersect is invoked
passing in an array (secondArr) it returns a new array containing the elements
common... | __label__POS | 0.997561 |
/***********************************************************************
Write a function named: lazyAdder(firstNum). The lazyAdder function will
accept a number and return a function. When the function returned by lazyAdder
is invoked it will again accept a number, (secondNum), and then return a function.
When the las... | __label__POS | 0.910737 |
package record
import (
"fmt"
"strings"
"github.com/appist/appy/support"
)
// Engine manages the databases.
type Engine struct {
databases map[string]DBer
errors []error
i18n *support.I18n
logger *support.Logger
}
// NewEngine initializes the engine instance to manage the databases.
func NewEngine... | __label__POS | 0.930109 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Fast RTPS: Class Me... | __label__POS | 0.929945 |
/***********************************************************************
Write a function `countScores(people)` that takes in an array of score
objects (people) as its input. A score object has two key-value pairs:
the scorer (string) and a point value (number). `countScores(people)` should
return an object that has ke... | __label__POS | 0.915118 |
/***********************************************************************
Write a function `appleCounter(appleObj)` that takes in an object containing a
number of keys that have the word 'apple' contained within them. The `appleCounter`
function will be in charge of returning the number of keys that contain the word
"... | __label__POS | 0.77952 |
/***********************************************************************
Write a function `stringConverter(string)` that will intake a
string as an argument and returns an object representing the count of each
character in the string. **Hint:** don't forget you can check if a key is present
in an object by using `obj[k... | __label__POS | 0.994092 |
/***********************************************************************
Write a function `arrayConverter(array)` that will intake an
array as an argument and returns an object representing the count of each
value in the array. **Hint:** don't forget you can check if a key is present
in an object by using `obj[key] ===... | __label__POS | 0.993693 |
class User < ApplicationRecord
attr_reader :password
validates :username, :password_digest, :session_token, presence: true
validates :username, uniqueness: true
validates :password, length: { minimum: 6 }, allow_nil: true
after_initialize :ensure_session_token
has_many :favorites
has_many :favorite_be... | __label__POS | 0.966634 |
/*
Write a function `chooseyEndings` that accepts an array of words and a suffix
string as arguments. The function should return a new array containing the words
that end in the given suffix. If the value passed in is not an array, return an
empty array. Solve this using Array's `filter()` method.
HINT: There are bui... | __label__POS | 0.900432 |
/*
Write a function `shortestWord` that accepts a sentence as an argument.
The function should return the shortest word in the sentence. If there is a tie,
return the word that appears later in the sentence.
Solve this using Array's `forEach()`, `map()`, `filter()` **OR** `reduce()`
methods.
Examples:
console.log(sh... | __label__POS | 0.962931 |
/*
Write a function `hipsterfy(sentence)` that takes in a sentence string and
returns the sentence where every word is missing it's last vowel.
Solve this using Array's `forEach()`, `map()`, `filter()` **OR** `reduce()`
methods.
Examples:
console.log(hipsterfy('When should everyone wake up?')); // 'Whn shold everyon... | __label__POS | 0.993941 |
/*
Write a function `longestWord(sentence)` that takes in a sentence string as an
argument. The function should return the longest word in the sentence.
You must use `Array.forEach` in your solution.
Solve this using Array's `forEach()`, `map()`, `filter()` **OR** `reduce()`
methods.
Examples:
console.log(longestW... | __label__POS | 0.749272 |
/*
Write a function `repeatingTranslate` that accepts a sentence as an argument.
The function should translate the sentence according to the following rules:
- words that are shorter than 3 characters are unchanged
- words that are 3 characters or longer are translated according to the
following rules:
- if the wo... | __label__POS | 0.940945 |
package support
import (
"regexp"
"strings"
)
type inflection struct {
regexp *regexp.Regexp
replace string
}
type inflectionRegular struct {
find string
replace string
}
type inflectionIrregular struct {
singular string
plural string
}
var (
singularInflections = []inflectionRegular{
{"s$", ""},
... | __label__POS | 0.744393 |
/*
Write a function `choosePrimes(nums)` that takes in an array of numbers as args.
The function should return a new array containing the primes from the original
array.
A prime number is a number that is only divisible by 1 and itself.
Hint: consider creating a helper function to check if a number is prime!
Solve t... | __label__POS | 0.998621 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Fast RTPS: Class Me... | __label__POS | 0.862397 |
package support
import (
"strings"
"unicode"
"github.com/fatih/camelcase"
)
// IsCamelCase checks if a string is camelCase.
func IsCamelCase(str string) bool {
return !isFirstRuneDigit(str) && isMadeByAlphanumeric(str) && unicode.IsLower(runeAt(str, 0))
}
// IsChainCase checks if a string is a chain-case.
func ... | __label__POS | 0.99977 |
# Learning Objectives For The Week
This is the introduction to Python. When you learned JavaScript, you may have
been starting out for the first time learning a language. This time, though,
you're learning a second language, which means you have some of the
understanding of concepts without necessarily knowing the syn... | __label__POS | 0.959518 |
/*******************************************************************************
Write a function `xorSelect` that accepts an array and two callback as arguments.
The function should return a new array containing elements of the original array
that result in true when passed in one of the callbacks, but not both.
Exam... | __label__POS | 0.732201 |
package support
import "reflect"
// ArrayContains checks if a value is in a slice of the same type.
func ArrayContains(arr interface{}, val interface{}) bool {
arrT := reflect.TypeOf(arr)
valT := reflect.TypeOf(val)
if (arrT.Kind().String() != "array" && arrT.Kind().String() != "slice") ||
arrT.Elem().String() !... | __label__POS | 0.999949 |
/*******************************************************************************
Write a function `chainMap` that accepts a value and any number of callbacks as
arguments. The function should return the final result of passing the value through
all of the given callbacks. In other words, if three callbacks are given th... | __label__POS | 0.987012 |
/*******************************************************************************
Write a function `none` that accepts an array and a callback as arguments.
The function should call the callback for each element of the array, passing in
the element. The function should return true if all
elements of the array result to ... | __label__POS | 0.987958 |
/*******************************************************************************
Write a function `andSelect` that accepts an array and two callbacks. The function
should return a new array containing elements of the original array that result in
true when passed into both callbacks.
Examples:
let isEven = function (... | __label__POS | 0.985642 |
/*******************************************************************************
Write a function `minValueCallback` that accepts an array and an optional callback as arguments.
If a callback is not passed in, then the function should return the smallest
value in the array. If a callback is passed in, then the function... | __label__POS | 0.994367 |
package support
import (
"bufio"
"bytes"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
// Logger provides the logging functionality.
type Logger struct {
*zap.SugaredLogger
}
// NewLogger initializes Logger instance.
func NewLogger() *Logger {
c := newLoggerConfig()
logger, _ := c.Build()
defer logger.Sync(... | __label__POS | 0.877276 |
/*******************************************************************************
Write a function `mySome` that accepts an array and a callback as an argument.
The function should call the callback for each element of the array, passing in
the element and its index. The function should return a boolean
indicating wheth... | __label__POS | 0.994881 |
package support
import (
"io"
"io/ioutil"
"net/http"
"os"
)
type (
// AssetManager implements all methods for Asset.
AssetManager interface {
Layout() *AssetLayout
Open(path string) (io.Reader, error)
ReadDir(dir string) ([]os.FileInfo, error)
ReadFile(filename string) ([]byte, error)
}
// Asset mana... | __label__POS | 0.638166 |
package support
import (
"testing"
"github.com/appist/appy/test"
)
type stringSuite struct {
test.Suite
}
func (s *stringSuite) TestIsCamelCase() {
tt := [][]interface{}{
{"fooBar", true},
{"fooBar1", true},
{"foo1Bar", true},
{"", false},
{"1FooBar", false},
{"1fooBar", false},
{"foo@Bar", false}... | __label__POS | 0.863611 |
/*******************************************************************************
Write a function `atMost` that accepts an array, a max number, and a callback as
arguments. The function should return a boolean indicating whether or not there are
no more than `max` elements of the array that result in true when passed i... | __label__POS | 0.954978 |
/*******************************************************************************
Write a function `selectiveMap` that accepts an array and two callbacks as arguments.
The function should return a new array where elements are replaced with the results
of calling the second callback on the element only if calling the fir... | __label__POS | 0.837122 |
/*******************************************************************************
Write a function `one` that accepts an array and a callback as arguments. The
function should call the callback for each element of the array, passing in the
element and its index. The function should return a boolean indicating whether
or... | __label__POS | 0.830959 |
/*******************************************************************************
Write a function `exactly` that accepts an array, a number, and a callback as
arguments. The function should return a boolean indicating whether or not there are
exactly `number` elements of the array that return true when passed into the ... | __label__POS | 0.95058 |
/*******************************************************************************
Write a function `myFilter` that accepts an array and a callback as arguments.
The function should call the callback on each element of the array, passing in
the element. The function should return a new array containing
the elements that ... | __label__POS | 0.91898 |
/*******************************************************************************
Write a function `sentenceMapper` that accepts a sentence and a callback as arguments.
The function should return a new sentence where every word of the original sentence
becomes the result of passing the word to the callback.
Examples:
... | __label__POS | 0.986241 |
/*******************************************************************************
Write a function `count` that accepts an array and a callback as arguments. The
function should return the number of elements of the array that return true when
passed to the callback.
Examples:
let result1 = count([18, 5, 32, 7, 100], f... | __label__POS | 0.976708 |
/*******************************************************************************
Write a function `mySimpleReduce` that accepts an array and a callback as arguments.
The function should mimic the behavior of the built in Array.reduce, utilizing the
first element of the array as the default accumulator.
In other words,... | __label__POS | 0.814232 |
/*******************************************************************************
Write a function `myForEach` that accepts an array and a callback as arguments.
The function should call the callback on each element of the array, passing in the
element, index, and array itself. The function does not need to return any v... | __label__POS | 0.987553 |
/*******************************************************************************
Write a function `alternatingMap` that accepts an array and two callbacks as
arguments. The function should return a new array containing the results of passing
the original elements into the callbacks in an alternating fashion.
In other ... | __label__POS | 0.84622 |
/*******************************************************************************
Write a function `firstIndex` that accepts an array and a callback as arguments.
The function should return the index of the first element of the array that
results in true when passed into the callback. If no elements of the array
result ... | __label__POS | 0.998493 |
/*******************************************************************************
Write a function `reject` that accepts an array and callback as arguments. The
function should call the callback for each element of the array, passing in the
element. The function should return a new array
containing elements of the origi... | __label__POS | 0.911995 |
/*******************************************************************************
Write a function `myEvery` that accepts an array and a callback as arguments.
The function should return a boolean indicating whether or not all elements of
the array return true when passed into the callback.
Do not use the built in Arra... | __label__POS | 0.993818 |
/*******************************************************************************
Write a function `suffixCipher` that accepts a sentence and object as arguments.
The object contains suffixes as keys and callbacks as values. The `suffixCipher`
function should return a new sentence where words of the original sentence ar... | __label__POS | 0.912755 |
/*
Refactoring Iteration
Given the function below that iterates through an object and prints all values
associated with keys that are vowels using Object.keys(), refactor the code
to use the for...in pattern to iterate through the object.
Key point here is to note how there are multiple ways to iterate through an
ob... | __label__POS | 0.74549 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Fast RTPS: Class Me... | __label__POS | 0.850133 |
/*
Write a function uncompress(str) that takes in a "compressed" string as an arg.
A compressed string consists of a character immediately followed by the number of times it appears in the "uncompressed" form.
The function should return the uncompressed version of the string. See the examples.
Hint: you can use the ... | __label__POS | 0.999759 |
/*
Nested Loops
* Sometimes a single loop is not enough to access a nested array
In that case, you'll write a loop within a loop
example
outer loop pauses until inner loop can complete
Since our inner loop is defined within the bounds of our outer
loop, the full cycle of our inner loop is part of... | __label__POS | 0.620046 |
/*
POLYAS FRAMEWORK
UNDERSTAND THE PROBLEM
input: "what a wonderful life"
output: "wonderful"
MAKE A PLAN
define a func called mostVowels
define a variable to hold the vowels
define a variable that tracks the word with the most vowels and most vowels count
split the string into an ... | __label__POS | 0.964217 |
/*
Helper Functions!
Sometimes we'll need to solve problems that can be broken down into smaller problems.
We can do that with Helper functions!
What is a helper function?
- function that performs part of the computation of another function
- can call a function from another function
Why would helper fu... | __label__POS | 0.940395 |
class User < ApplicationRecord
attr_reader :password
validates :username, :password_digest, :session_token, presence: true
validates :username, uniqueness: true
validates :password, length: { minimum: 6 }, allow_nil: true
after_initialize :ensure_session_token
has_many :favorites
has_many :favorite_be... | __label__POS | 0.966634 |
// Your code here
/*
POLYAS FRAMEWORK
UNDERSTAND THE PROBLEM
Input: snakes_go_hiss
Output: SnakesGoHiss
MAKE A PLAN
EXECUTE THE PLAN
REFACTOR
*/
// define function snaketocamel
let snakeToCamel = (string) => string.split('_').map(word => `${word[0].toUpperCase()}${word.slice(1).toLowerCase... | __label__POS | 0.815485 |
// Adjacent Sum
/*
Write a function adjacentSum that takes in an array of numbers and returns a new array containing the sums of adjacent
numbers in the original array. See the examples.
input: arr
output: arr
make a plan!
1. create a variable representing our result
2. iterate through numArray to gain access to t... | __label__POS | 0.998388 |
/*
Homework Review
Arrays
* Arrays are useful when you need to hold more than just value;
* Arrays are ordered collections of values.
* Similar to strings; arrays have indices
* We can access the value by using the index
* We can use loops to iterate through arrays
*/
// Maybe we want to ret... | __label__POS | 0.893437 |
// your code here
// let rotateRight = (array, num) => array.slice(-num).concat(array.slice(0, -num))
// console.log(test);
// 2. create a copy of the array - use slice??
let rotate = function(array, num) {
// let res = num > 0 ? num : -(num);
let res;
if(num > 0) {
res = num;
} e... | __label__POS | 0.980146 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Fast RTPS: Class Me... | __label__POS | 0.70394 |
/*
Understanding the problem
Input: array and a string => ['a', 'b', 'c', 'e'], 'c'
Output: a boolean => true
* How do we get from our input to the the output?
Make a plan
1. define a function hasElement
2. iterate through the array
a. make a variable for the element at the index call it... | __label__POS | 0.997721 |
/*
Loops
Loops provide us a way to repeat behavior a set number of times.
* We can use that behavior to progress through data structures and take a look at individual elements.
* Loops consist of 3 main components:
1. Initial Expression
2. Condition for which we keep looping
3. Step towards comple... | __label__POS | 0.920465 |
/*
You are compiling a price checker for a grocery store. The grocery prices are as
follows:
// butter: $1,
// eggs: $2,
// milk: $3,
// bread: $4,
// cheese: $5
First, create a function called costOfGroceries(groceries) which takes a single
array of grocery items and returns the total cost.
Then, write a ... | __label__POS | 0.98423 |
/*
Build a function called stringChanger that takes in two arguments: a word
and an operation. Based on the operation, your function will return the word
modified in some way. The operations are:
1. isolate the first letter - slice
- upper case it! using toUpperCase()
2. the second half of the word
- return the f... | __label__POS | 0.995149 |
/***********************************************************************
Write a recursive function, `range`, that takes a start and an end and returns
an array of all numbers in that range, exclusive. If the end number is less than
the start, return an empty array.
****************************************************... | __label__POS | 0.999361 |
/***********************************************************************
Write a recursive function called `sort` that takes an array of integers, `nums`
and returns an array containing those integers sorted from least to greatest.
Your function should accept a default argument called `sorted` which
holds the currentl... | __label__POS | 0.998526 |
/***********************************************************************
Write a recursive function called `sumArray` that takes an array of integers
and returns the value of all the integers added together. Your array may
include a mix of positive and negative integers!
Examples:
sumArray([1, 2, 3]); // 6
sumArray(... | __label__POS | 0.975665 |
package course.examples.ui.cardview;
import android.app.Activity;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
public class CardViewActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
... | __label__POS | 0.949932 |
require 'rspec'
require 'bst'
describe BinarySearchTree do
let(:bst) { BinarySearchTree.new }
let(:prefilled_bst) do
bst = BinarySearchTree.new
[5, 3, 7, 1, 4, 9, 0, 2, 1.5, 10].each do |el|
bst.insert(el)
end
bst
end
#############################
# prefilled_bst looks like: #
# ... | __label__POS | 0.964521 |
BSTNode = Struct.new(:value, :left, :right)
class BinarySearchTree
def initialize
@root = nil
end
def insert(value)
@root = insert_tree_node(@root, value)
# make new node based on value, if root is nil make the new node the root.
# If value is greater than root.value, recusively inser the value... | __label__POS | 0.93278 |
/***********************************************************************
Write a function, `intervalCount`, that accepts a callback, a delay in
milliseconds, and an amount. The function should set an interval with
the given callback and delay, but clear the interval after the callback
has been executed 'amount' numbe... | __label__POS | 0.654004 |
/***********************************************************************
Write a function, `batchTimeouts`, that accepts an array of callbacks and an
array of delays in milliseconds. The function should set a timeout for each
callback in the array with its corresponding delay. For example, the
callback at index 0 shoul... | __label__POS | 0.804812 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.