Get last character

Inputs

  • String

Outputs

  • Last character
  • Residue

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
String: Hello
Last character: o
Residue: Hell
2.
String: You
Last character: u
Residue: Yo
3.
String: 12345
Last character: 5
Residue: 1234

Applicable neurons

  • Substring (from start to position)
  • Length of string
  • Substring (from position to end)
  • x - 1
  • Destroyed building (calculation, windows, walls)
  • 1000
  • delete a period at the end of a sentence
  • character ]
  • a ≥ b
  • 10000
  • a-z
  • character y
  • First child X position
  • sql AVG(A, B)
  • Convert seconds into HH:MM:SS

Algorithm

Test

Code made by AI:
/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

/**
 * Minus (x - y): 
 *
 * @param x1 Number X
 * @param x2 Number Y
 * @return {Array}
 */
function neuron2(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '-'+Number(x2)).toString()];
}

/**
 * x - 1: 
 * 
 * @param x1 x
 * @return {Array}
 */
function neuron595(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron501();
  outputs[1] = arr[0];

  arr = neuron2(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  return[outputs[2]];
}


/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Substring (from position to end): 
 * 
 * @param x1 MyString
 * @param x2 start position
 * @return {Array}
 */
function neuron529(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron528(outputs[0]);
  outputs[2] = arr[0];

  arr = neuron525(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Substring (from start to position): 
 * 
 * @param x1 String
 * @param x2 End position
 * @return {Array}
 */
function neuron526(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron500();
  outputs[2] = arr[0];

  arr = neuron525(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * Get last character: 
 * 
 * @param x1 String
 * @return {Array}
 */
function neuron684(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron528(outputs[0]);
  outputs[1] = arr[0];

  arr = neuron595(outputs[1]);
  outputs[2] = arr[0];

  arr = neuron529(outputs[0], outputs[2]);
  outputs[3] = arr[0];

  arr = neuron526(outputs[0], outputs[2]);
  outputs[4] = arr[0];

  return[outputs[3], outputs[4]];
}


Code made by AI:

Create your family tree for free