## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Jose Dzireh Chong
@CodingDucky
wiki caesars cipher
CamperBot
@camperbot

# Problem Explanation:

• You need to write a function, which will take string encoded with
Caesar cipher as a parameter and decode it.
• The one used here is ROT13 where the value of the letter is
shifted by 13 places.
e.g. 'A' ↔ 'N', 'T' ↔ 'G'.
• You have to shift it back 13 positions, such that 'N' ↔ 'A'.
Jose Dzireh Chong
@CodingDucky
hint
CamperBot
@camperbot

hint [1/8]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jose Dzireh Chong
@CodingDucky
hint
CamperBot
@camperbot

hint [2/8]

## # Explanation:

This can be a tricky problem to understand. You need to find where in the array a number should be inserted by order, and return the index where it should go.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jose Dzireh Chong
@CodingDucky
hint
CamperBot
@camperbot

hint [3/8]

## Hint: 1

The first thing to do is sort the array from lower to bigger, just to make the code easier. This is where sort comes in, it needs a callback function so you have to create it.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jose Dzireh Chong
@CodingDucky
hint
CamperBot
@camperbot

hint [4/8]

## Hint: 2

Once the array is sorted, then just check for the first number that is bigger and return the index.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jose Dzireh Chong
@CodingDucky
hint
CamperBot
@camperbot

hint [5/8]

## Hint: 3

If there is no index for that number then you will have to deal with that case too.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jose Dzireh Chong
@CodingDucky
hint
CamperBot
@camperbot

hint [6/8]

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jose Dzireh Chong
@CodingDucky
nopenopenope
wait thats not even the right puzzle
wtf
Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [1/8]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [2/8]

## # Explanation:

This can be a tricky problem to understand. You need to find where in the array a number should be inserted by order, and return the index where it should go.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [3/8]

## Hint: 1

The first thing to do is sort the array from lower to bigger, just to make the code easier. This is where sort comes in, it needs a callback function so you have to create it.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [4/8]

## Hint: 2

Once the array is sorted, then just check for the first number that is bigger and return the index.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [5/8]

## Hint: 3

If there is no index for that number then you will have to deal with that case too.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [6/8]

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [7/8]

## Code Solution:

function where(arr, num) {
arr.sort(function(a, b) {
return a - b;
});

for (var a = 0; a < arr.length; a++) {
if (arr[a] >= num)
return parseInt(a);
}

return arr.length;
}

# Code Explanation:

• First I sort the array using .sort(callbackFuntion) to sort it by lowest to highest, from left to right.
• Then I use a for loop to compare the items in the array starting from the smallest one. When an item on the array is greater than the number we are comparing against, then we return the index as an integer.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Jessie
@jvhensley
hint
CamperBot
@camperbot

hint [8/8]

## Code Solution 2:

function where(arr, num) {
arr.push(num);
arr.sort(function(a, b)
{return a-b;}
);
return arr.indexOf(num);
}

# Code Explanation:

• First insert the number into the array using the Array.push() method.
• Then use the numerical sort method to sort the elements of the array. in the end just return the index value of the number that was push earlier using the Array.indexOf() method.

# Credits:

If you found this page useful, you can give thanks by copying and pasting this on the main chat: Thanks @Rafase282 and @rahul1992 for your help with Bonfire: Where do I belong

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Chris Dalton
@manwithgills
hint
CamperBot
@camperbot

hint [1/1]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Chris Dalton
@manwithgills
hint
CamperBot
@camperbot
These hints depend on people like you! Please add to this :point_right: Bonfire's Wiki Hints Page
Ivan Yulin
@Yulin777
bonfire where do I belong
CamperBot
@camperbot

## :fire:Bonfire: Where do I belong :link:

function where(arr, num) {
// Find my place in this sorted array.
return num;
}

where([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:  bf details | bf links | hint

Ivan Yulin
@Yulin777
hint
CamperBot
@camperbot

hint [1/1]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ivan Yulin
@Yulin777
hint
CamperBot
@camperbot
These hints depend on people like you! Please add to this :point_right: Bonfire's Wiki Hints Page
Ivan Yulin
@Yulin777

@Yulin777
hey fellas can you help me find why my code work partially for the bonfire "Where do I belong"

function getIndexToIns(arr, num) {
// Find my place in this sorted array.
var array = arr.sort();
for (var i=0 ; i<array.length ; i++){
if ((num >= array[i]) && (num <= array[i+1]))
{
if (num == array[i])
return i;
return i+1;
}
}

}

getIndexToIns([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.

For example, getIndexToIns([1,2,3,4], 1.5) should return 1 because it is greater than 1 (index 0), but less than 2 (index 1).

Likewise, getIndexToIns([20,3,5], 19) should return 2 because once the array has been sorted it will look like [3,5,20] and 19 is less than 20 (index 2) and greater than 5 (index 1).

CamperBot
@camperbot
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Tonye Dixon
@tonye-d
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
var array = arr.sort();
for(var i = 0; i < arr.length; i++) {
if(num > array[i] && num < array[i + 1]) {
return array.indexOf(i + 1) + 1;
} else if (num == array[i]) {
return array.indexOf(i) + 1;
}
}
}
getIndexToIns([40, 60], 50);
help needed here.
hint
CamperBot
@camperbot

hint [1/1]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Tonye Dixon
@tonye-d
hint
CamperBot
@camperbot
These hints depend on people like you! Please add to this :point_right: Bonfire's Wiki Hints Page