My list of strings isn't working, Tinkercad says to reduce my footprint

Hi, I am working on creating the math game "Make 24". I have 2 lists of strings (which I made a JavaScript program to make for me), one for the cards and one for the solutions. The cards are stored in the format: "number 1, number 2, number 3, number 4". The solutions are stored as an equation. Unfortunately, I can't get the lists to stop producing errors. I have already checked the forum and wasn't able to find a solution (I also checked online, and the solutions I saw didn't work). When I load it up in Tinkercad, I get the following error message: "//support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing your footprint." I checked it, but the lists I am using are required. They are the only way I can think of to store the valid cards and their solutions (and I have already optimized them to the best of my ability). Any help would be appreciated. Here are the lists and the current code:

const String cards[306] = {"1,1,2,6", "1,1,2,8", "1,1,3,4", "1,1,3,6", "1,1,3,7", "1,1,3,8", "1,1,3,9", "1,1,4,5", "1,1,4,6", "1,1,4,7", "1,1,4,8", "1,1,5,5", "1,1,5,6", "1,1,6,9", "1,1,8,8", "1,2,2,4", "1,2,2,5", "1,2,2,6", "1,2,2,7", "1,2,3,3", "1,2,3,4", "1,2,3,5", "1,2,3,6", "1,2,3,7", "1,2,3,8", "1,2,3,9", "1,2,4,4", "1,2,4,6", "1,2,4,8", "1,2,4,9", "1,2,5,5", "1,2,5,7", "1,2,5,8", "1,2,5,9", "1,2,6,6", "1,2,6,7", "1,2,6,8", "1,2,6,9", "1,2,7,8", "1,2,7,9", "1,2,8,8", "1,2,8,9", "1,3,3,4", "1,3,3,5", "1,3,3,6", "1,3,3,7", "1,3,3,8", "1,3,3,9", "1,3,4,4", "1,3,4,5", "1,3,4,7", "1,3,4,8", "1,3,4,9", "1,3,5,6", "1,3,5,8", "1,3,5,9", "1,3,6,6", "1,3,6,7", "1,3,6,8", "1,3,6,9", "1,3,7,9", "1,3,8,8", "1,3,8,9", "1,3,9,9", "1,4,4,4", "1,4,4,5", "1,4,4,6", "1,4,4,7", "1,4,4,8", "1,4,4,9", "1,4,5,5", "1,4,5,7", "1,4,5,8", "1,4,5,9", "1,4,6,6", "1,4,6,8", "1,4,7,8", "1,4,8,8", "1,4,8,9", "1,5,5,6", "1,5,6,6", "1,5,6,7", "1,5,6,9", "1,5,8,8", "1,5,9,9", "1,6,6,6", "1,6,8,9", "1,6,9,9", "1,7,7,9", "1,7,8,8", "1,7,8,9", "1,7,9,9", "1,8,8,8", "1,8,8,9", "2,2,2,3", "2,2,2,4", "2,2,2,8", "2,2,2,9", "2,2,3,3", "2,2,3,6", "2,2,3,8", "2,2,3,9", "2,2,4,5", "2,2,4,6", "2,2,4,7", "2,2,4,8", "2,2,4,9", "2,2,5,5", "2,2,5,6", "2,2,5,7", "2,2,5,8", "2,2,6,6", "2,2,6,7", "2,2,6,8", "2,2,7,8", "2,2,8,8", "2,2,8,9", "2,3,3,5", "2,3,3,6", "2,3,3,7", "2,3,3,8", "2,3,3,9", "2,3,4,4", "2,3,4,6", "2,3,4,7", "2,3,4,8", "2,3,4,9", "2,3,5,5", "2,3,5,6", "2,3,5,7", "2,3,5,8", "2,3,5,9", "2,3,6,6", "2,3,6,7", "2,3,6,8", "2,3,6,9", "2,3,7,7", "2,3,7,8", "2,3,7,9", "2,3,8,8", "2,3,8,9", "2,3,9,9", "2,4,4,4", "2,4,4,5", "2,4,4,6", "2,4,4,7", "2,4,4,8", "2,4,4,9", "2,4,5,5", "2,4,5,6", "2,4,5,7", "2,4,5,8", "2,4,5,9", "2,4,6,6", "2,4,6,7", "2,4,6,8", "2,4,6,9", "2,4,7,7", "2,4,7,8", "2,4,7,9", "2,4,8,8", "2,4,9,9", "2,5,5,7", "2,5,5,9", "2,5,6,6", "2,5,6,7", "2,5,6,8", "2,5,6,9", "2,5,7,7", "2,5,7,9", "2,5,8,8", "2,5,8,9", "2,6,6,6", "2,6,6,7", "2,6,6,8", "2,6,6,9", "2,6,7,8", "2,6,7,9", "2,6,8,8", "2,6,8,9", "2,7,7,8", "2,7,8,9", "2,8,8,8", "2,8,9,9", "3,3,3,3", "3,3,3,4", "3,3,3,5", "3,3,3,6", "3,3,3,8", "3,3,4,4", "3,3,4,5", "3,3,4,6", "3,3,4,8", "3,3,4,9", "3,3,5,5", "3,3,5,6", "3,3,5,9", "3,3,6,7", "3,3,6,8", "3,3,6,9", "3,3,7,8", "3,3,7,9", "3,3,8,9", "3,3,9,9", "3,4,4,4", "3,4,4,5", "3,4,4,6", "3,4,4,8", "3,4,4,9", "3,4,5,5", "3,4,5,7", "3,4,5,8", "3,4,6,6", "3,4,6,8", "3,4,7,7", "3,4,7,8", "3,4,7,9", "3,4,8,9", "3,4,9,9", "3,5,5,6", "3,5,5,8", "3,5,6,7", "3,5,6,8", "3,5,6,9", "3,5,7,8", "3,5,7,9", "3,5,8,8", "3,5,8,9", "3,5,9,9", "3,6,6,6", "3,6,6,7", "3,6,6,8", "3,6,6,9", "3,6,7,8", "3,6,7,9", "3,6,8,8", "3,6,9,9", "3,7,7,7", "3,7,7,8", "3,7,8,8", "3,8,8,8", "3,8,8,9", "3,8,9,9", "3,9,9,9", "4,4,4,4", "4,4,4,6", "4,4,4,8", "4,4,4,9", "4,4,5,5", "4,4,5,6", "4,4,5,8", "4,4,6,9", "4,4,7,8", "4,4,7,9", "4,4,8,8", "4,4,8,9", "4,5,5,5", "4,5,5,6", "4,5,5,9", "4,5,6,6", "4,5,6,9", "4,5,7,7", "4,5,7,8", "4,5,7,9", "4,5,8,9", "4,6,6,6", "4,6,6,7", "4,6,6,8", "4,6,6,9", "4,6,7,7", "4,6,7,8", "4,6,7,9", "4,6,8,8", "4,6,8,9", "4,6,9,9", "4,7,8,8", "4,8,8,8", "5,5,5,5", "5,5,5,6", "5,5,5,9", "5,5,6,6", "5,5,6,7", "5,5,6,8", "5,5,7,7", "5,5,7,8", "5,5,8,8", "5,5,8,9", "5,5,9,9", "5,6,6,7", "5,6,6,8", "5,6,6,9", "5,6,7,9", "5,6,8,9", "5,6,9,9", "5,7,8,8", "5,7,8,9", "5,8,8,8", "5,8,8,9", "6,6,6,6", "6,6,6,9", "6,6,8,9", "6,7,9,9", "6,8,8,8", "6,8,8,9", "6,8,9,9", "7,8,8,9"};

const String solutions[306] = {"(1+1)*2*6", "(1+2)*1*8", "(1+1)*3*4", "(1+3)*1*6", "(1+7)*1*3", "(1-1)+3*8", "(9-1)*1*3", "(1+4)*5-1", "(1-1)+4*6", "(7-1)*1*4", "(4-1)*1*8", "(1*5)*5-1", "(5-1)*1*6", "(1+1)*9+6", "(1+1)*8+8", "(1+2)*2*4", "(1+5)*2*2", "(1*2)*2*6", "(7-1)*2*2", "(1+3)*2*3", "(1*2)*3*4", "(2+3)*5-1", "(2+6)*1*3", "(1+2)+3*7", "(2-1)*3*8", "(1+2)*9-3", "(2+4)*1*4", "(2-1)*4*6", "(4+8)*1*2", "(1+9)*2+4", "(1-2)+5*5", "(5+7)*1*2", "(1+5)/2*8", "(1+2)*5+9", "(1+2)*6+6", "(1+7)/2*6", "(1/2)*6*8", "(1*2)*9+6", "(1+7)+2*8", "(1+9)+2*7", "(1*2)*8+8", "(2*8)-1+9", "(3-1)*3*4", "(3+5)*1*3", "(1+6)*3+3", "(1*3)+3*7", "(1+8)*3-3", "(1*3)*9-3", "(4+4)*1*3", "(1+3)+4*5", "(1+3)*7-4", "(1+3)*4+8", "(1+4)*3+9", "(1+5)+3*6", "(1+8)+3*5", "(1*3)*5+9", "(1*3)*6+6", "(3*6)-1+7", "(6-3)*1*8", "(1+9)*3-6", "(1+7)/3*9", "(1+3)*8-8", "(1/3)*8*9", "(9-1)/3*9", "(1+4)*4+4", "(1*4)+4*5", "(1+6)*4-4", "(1*4)*7-4", "(1*4)*4+8", "(4*4)-1+9", "(4*5)-1+5", "(1-5)+4*7", "(5-1)*4+8", "(4-1)*5+9", "(1+4)*6-6", "(8-4)*1*6", "(1+7)*4-8", "(1*4)*8-8", "(1-9)+4*8", "(1+5)*5-6", "(1*5)*6-6", "(1-7)+5*6", "(9-5)*1*6", "(5-1)*8-8", "(1+5)+9+9", "(6-1)*6-6", "(1+6)+8+9", "(1*6)+9+9", "(1+7)+7+9", "(1+7)+8+8", "(1*7)+8+9", "(7-1)+9+9", "(1*8)+8+8", "(8-1)+8+9", "(2+2)*2*3", "(2+4)*2*2", "(8-2)*2*2", "(2+9)*2+2", "(3+3)*2*2", "(6-2)*2*3", "(2-2)+3*8", "(2*3)+2*9", "(2+2)+4*5", "(2-2)+4*6", "(2+2)*7-4", "(2+2)*4+8", "(2+4)+2*9", "(5*5)-2/2", "(5+6)*2+2", "(2*5)+2*7", "(5+8)*2-2", "(2+6)/2*6", "(2+7)*2+6", "(2+6)+2*8", "(2*7)+2+8", "(2+2)*8-8", "(2*9)-2+8", "(2+5)*3+3", "(2*3)+3*6", "(2+7)*3-3", "(3-2)*3*8", "(2+3)*3+9", "(2+3)*4+4", "(2+4)+3*6", "(3+7)*2+4", "(8-4)*2*3", "(2/3)*4*9", "(2-3)+5*5", "(2*3)*5-6", "(2+7)+3*5", "(2*8)+3+5", "(2-5)+3*9", "(2+3)*6-6", "(3*7)+6/2", "(2+8)*3-6", "(2+6)/3*9", "(2*7)+3+7", "(2+7)/3*8", "(7-2)*3+9", "(8+8)/2*3", "(9-3)/2*8", "(2*3)+9+9", "(2*4)+4*4", "(2+5)*4-4", "(2+6)+4*4", "(7-2)*4+4", "(2*4)*4-8", "(9-2)*4-4", "(5+5)*2+4", "(2+4)*5-6", "(5+7)/2*4", "(4*5)+8/2", "(5+9)*2-4", "(6-4)*2*6", "(2-6)+4*7", "(2/4)*6*8", "(4-2)*9+6", "(7+7)*2-4", "(4*7)-8/2", "(2*4)+7+9", "(2*4)+8+8", "(2+4)+9+9", "(2*7)+5+5", "(2*5)+5+9", "(5-2)*6+6", "(2*6)+5+7", "(2*5)+6+8", "(5/2)*6+9", "(2*5)+7+7", "(5*7)-2-9", "(5*8)-2*8", "(2+5)+8+9", "(2*6)+6+6", "(7-2)*6-6", "(8-6)*2*6", "(6+9)*2-6", "(7+8)*2-6", "(2+6)+7+9", "(2+6)+8+8", "(2/6)*8*9", "(2+7)+7+8", "(7+9)*2-8", "(8/2)*8-8", "(8-2)+9+9", "(3*3)*3-3", "(3+4)*3+3", "(3*3)+3*5", "(3+3)+3*6", "(3-3)+3*8", "(3*4)+3*4", "(4+5)*3-3", "(3-3)+4*6", "(4-3)*3*8", "(3*4)+3+9", "(5*5)-3/3", "(3+3)*5-6", "(3+5)/3*9", "(3+7)*3-6", "(3+6)/3*8", "(3*3)+6+9", "(3*3)+7+8", "(3*7)+9/3", "(3+8)*3-9", "(3+3)+9+9", "(3+4)*4-4", "(3+5)+4*4", "(4-3)*4*6", "(3*4)+4+8", "(4+4)/3*9", "(3-4)+5*5", "(3*4)+5+7", "(3+5)*4-8", "(3*4)+6+6", "(4+8)/3*6", "(3-7)+4*7", "(7-3)*4+8", "(3*9)+4-7", "(3+4)+8+9", "(4*9)-3-9", "(5+5)*3-6", "(3*5)/5*8", "(5+7)/3*6", "(6-5)*3*8", "(3-9)+5*6", "(3*7)-5+8", "(3+5)+7+9", "(3+5)+8+8", "(3*9)+5-8", "(5/3)*9+9", "(6-3)*6+6", "(6*7)-3*6", "(3*6)/6*8", "(3+6)+6+9", "(3+6)+7+8", "(3*7)-6+9", "(6/3)*8+8", "(3*9)+6-9", "(3+7)+7+7", "(3*7)/7*8", "(7-3)*8-8", "(3*8)+8-8", "(9-8)*3*8", "(3*8)+9-9", "(9-3)+9+9", "(4+4)+4*4", "(4-4)+4*6", "(4+4)*4-8", "(9-4)*4+4", "(5*5)-4/4", "(5-4)*4*6", "(4*5)-4+8", "(4*4)/6*9", "(4*7)+4-8", "(4+4)+7+9", "(4+4)+8+8", "(4*9)-4-8", "(4-5)+5*5", "(4*5)/5*6", "(4*5)-5+9", "(6-5)*4*6", "(4+5)+6+9", "(5*7)-4-7", "(4+5)+7+8", "(4*7)+5-9", "(9-5)*4+8", "(4*6)+6-6", "(7-4)*6+6", "(4+6)+6+8", "(4*9)-6-6", "(4+6)+7+7", "(8-7)*4*6", "(7+9)/4*6", "(4*6)+8-8", "(8/4)*9+6", "(4*6)+9-9", "(7*8)-4*8", "(8-4)*8-8", "(5*5)-5/5", "(5*5)+5-6", "(5+5)+5+9", "(5*5)-6/6", "(5*5)+6-7", "(5+5)+6+8", "(5+5)+7+7", "(5*5)+7-8", "(5*5)-8/8", "(5*5)+8-9", "(5*5)-9/9", "(5+6)+6+7", "(8-5)*6+6", "(6*9)-5*6", "(7-5)*9+6", "(6+9)/5*8", "(9-6)*5+9", "(7-5)*8+8", "(5*8)-7-9", "(5*8)-8-8", "(9-5)*8-8", "(6+6)+6+6", "(6*6)*6/9", "(8-6)*9+6", "(6*7)-9-9", "(8-6)*8+8", "(8+8)/6*9", "(9+9)/6*8", "(9-7)*8+8"};

I have also tried removing 'String', but that didn't work either (the error message was about name types not being there).

If it is possible to do this without downloading any libraries that would be great, since I am doing my testing on Tinkercad which doesn't allow you to download libraries (I am working on Tinkercad because I find it easier to work online and then build it IRL once it works).

Assuming you are simulating an Arduino UNO in TInkercad, you will need to store the strings in PROGMEM instead of ram. The cards array uses 2448 bytes of memory, solutions uses 3060 bytes, for a total of 5508 bytes, well in excess of the 2048 bytes of ram on an UNO.

Better to use an array of char instead of String, and since the strings are a consistent length a 2-dimensional array is the easiest to use. When printing a string from an array in PROGMEM, it needs to be cast to __FlashStringHelper* so that the print() function will handle it properly.

const char cards[306][9] PROGMEM = {
  "1,1,2,6", "1,1,2,8", "1,1,3,4", "1,1,3,6", "1,1,3,7", "1,1,3,8", "1,1,3,9", "1,1,4,5",
  "1,1,4,6", "1,1,4,7", "1,1,4,8", "1,1,5,5", "1,1,5,6", "1,1,6,9", "1,1,8,8", "1,2,2,4",
  "1,2,2,5", "1,2,2,6", "1,2,2,7", "1,2,3,3", "1,2,3,4", "1,2,3,5", "1,2,3,6", "1,2,3,7",
  "1,2,3,8", "1,2,3,9", "1,2,4,4", "1,2,4,6", "1,2,4,8", "1,2,4,9", "1,2,5,5", "1,2,5,7",
  "1,2,5,8", "1,2,5,9", "1,2,6,6", "1,2,6,7", "1,2,6,8", "1,2,6,9", "1,2,7,8", "1,2,7,9",
  "1,2,8,8", "1,2,8,9", "1,3,3,4", "1,3,3,5", "1,3,3,6", "1,3,3,7", "1,3,3,8", "1,3,3,9",
  "1,3,4,4", "1,3,4,5", "1,3,4,7", "1,3,4,8", "1,3,4,9", "1,3,5,6", "1,3,5,8", "1,3,5,9",
  "1,3,6,6", "1,3,6,7", "1,3,6,8", "1,3,6,9", "1,3,7,9", "1,3,8,8", "1,3,8,9", "1,3,9,9",
  "1,4,4,4", "1,4,4,5", "1,4,4,6", "1,4,4,7", "1,4,4,8", "1,4,4,9", "1,4,5,5", "1,4,5,7",
  "1,4,5,8", "1,4,5,9", "1,4,6,6", "1,4,6,8", "1,4,7,8", "1,4,8,8", "1,4,8,9", "1,5,5,6",
  "1,5,6,6", "1,5,6,7", "1,5,6,9", "1,5,8,8", "1,5,9,9", "1,6,6,6", "1,6,8,9", "1,6,9,9",
  "1,7,7,9", "1,7,8,8", "1,7,8,9", "1,7,9,9", "1,8,8,8", "1,8,8,9", "2,2,2,3", "2,2,2,4",
  "2,2,2,8", "2,2,2,9", "2,2,3,3", "2,2,3,6", "2,2,3,8", "2,2,3,9", "2,2,4,5", "2,2,4,6",
  "2,2,4,7", "2,2,4,8", "2,2,4,9", "2,2,5,5", "2,2,5,6", "2,2,5,7", "2,2,5,8", "2,2,6,6",
  "2,2,6,7", "2,2,6,8", "2,2,7,8", "2,2,8,8", "2,2,8,9", "2,3,3,5", "2,3,3,6", "2,3,3,7",
  "2,3,3,8", "2,3,3,9", "2,3,4,4", "2,3,4,6", "2,3,4,7", "2,3,4,8", "2,3,4,9", "2,3,5,5",
  "2,3,5,6", "2,3,5,7", "2,3,5,8", "2,3,5,9", "2,3,6,6", "2,3,6,7", "2,3,6,8", "2,3,6,9",
  "2,3,7,7", "2,3,7,8", "2,3,7,9", "2,3,8,8", "2,3,8,9", "2,3,9,9", "2,4,4,4", "2,4,4,5",
  "2,4,4,6", "2,4,4,7", "2,4,4,8", "2,4,4,9", "2,4,5,5", "2,4,5,6", "2,4,5,7", "2,4,5,8",
  "2,4,5,9", "2,4,6,6", "2,4,6,7", "2,4,6,8", "2,4,6,9", "2,4,7,7", "2,4,7,8", "2,4,7,9",
  "2,4,8,8", "2,4,9,9", "2,5,5,7", "2,5,5,9", "2,5,6,6", "2,5,6,7", "2,5,6,8", "2,5,6,9",
  "2,5,7,7", "2,5,7,9", "2,5,8,8", "2,5,8,9", "2,6,6,6", "2,6,6,7", "2,6,6,8", "2,6,6,9",
  "2,6,7,8", "2,6,7,9", "2,6,8,8", "2,6,8,9", "2,7,7,8", "2,7,8,9", "2,8,8,8", "2,8,9,9",
  "3,3,3,3", "3,3,3,4", "3,3,3,5", "3,3,3,6", "3,3,3,8", "3,3,4,4", "3,3,4,5", "3,3,4,6",
  "3,3,4,8", "3,3,4,9", "3,3,5,5", "3,3,5,6", "3,3,5,9", "3,3,6,7", "3,3,6,8", "3,3,6,9",
  "3,3,7,8", "3,3,7,9", "3,3,8,9", "3,3,9,9", "3,4,4,4", "3,4,4,5", "3,4,4,6", "3,4,4,8",
  "3,4,4,9", "3,4,5,5", "3,4,5,7", "3,4,5,8", "3,4,6,6", "3,4,6,8", "3,4,7,7", "3,4,7,8",
  "3,4,7,9", "3,4,8,9", "3,4,9,9", "3,5,5,6", "3,5,5,8", "3,5,6,7", "3,5,6,8", "3,5,6,9",
  "3,5,7,8", "3,5,7,9", "3,5,8,8", "3,5,8,9", "3,5,9,9", "3,6,6,6", "3,6,6,7", "3,6,6,8",
  "3,6,6,9", "3,6,7,8", "3,6,7,9", "3,6,8,8", "3,6,9,9", "3,7,7,7", "3,7,7,8", "3,7,8,8",
  "3,8,8,8", "3,8,8,9", "3,8,9,9", "3,9,9,9", "4,4,4,4", "4,4,4,6", "4,4,4,8", "4,4,4,9",
  "4,4,5,5", "4,4,5,6", "4,4,5,8", "4,4,6,9", "4,4,7,8", "4,4,7,9", "4,4,8,8", "4,4,8,9",
  "4,5,5,5", "4,5,5,6", "4,5,5,9", "4,5,6,6", "4,5,6,9", "4,5,7,7", "4,5,7,8", "4,5,7,9",
  "4,5,8,9", "4,6,6,6", "4,6,6,7", "4,6,6,8", "4,6,6,9", "4,6,7,7", "4,6,7,8", "4,6,7,9",
  "4,6,8,8", "4,6,8,9", "4,6,9,9", "4,7,8,8", "4,8,8,8", "5,5,5,5", "5,5,5,6", "5,5,5,9",
  "5,5,6,6", "5,5,6,7", "5,5,6,8", "5,5,7,7", "5,5,7,8", "5,5,8,8", "5,5,8,9", "5,5,9,9",
  "5,6,6,7", "5,6,6,8", "5,6,6,9", "5,6,7,9", "5,6,8,9", "5,6,9,9", "5,7,8,8", "5,7,8,9",
  "5,8,8,8", "5,8,8,9", "6,6,6,6", "6,6,6,9", "6,6,8,9", "6,7,9,9", "6,8,8,8", "6,8,8,9",
  "6,8,9,9", "7,8,8,9"
};

const char solutions[306][10] PROGMEM = {
  "(1+1)*2*6", "(1+2)*1*8", "(1+1)*3*4", "(1+3)*1*6", "(1+7)*1*3", "(1-1)+3*8", "(9-1)*1*3", "(1+4)*5-1",
  "(1-1)+4*6", "(7-1)*1*4", "(4-1)*1*8", "(1*5)*5-1", "(5-1)*1*6", "(1+1)*9+6", "(1+1)*8+8", "(1+2)*2*4",
  "(1+5)*2*2", "(1*2)*2*6", "(7-1)*2*2", "(1+3)*2*3", "(1*2)*3*4", "(2+3)*5-1", "(2+6)*1*3", "(1+2)+3*7",
  "(2-1)*3*8", "(1+2)*9-3", "(2+4)*1*4", "(2-1)*4*6", "(4+8)*1*2", "(1+9)*2+4", "(1-2)+5*5", "(5+7)*1*2",
  "(1+5)/2*8", "(1+2)*5+9", "(1+2)*6+6", "(1+7)/2*6", "(1/2)*6*8", "(1*2)*9+6", "(1+7)+2*8", "(1+9)+2*7",
  "(1*2)*8+8", "(2*8)-1+9", "(3-1)*3*4", "(3+5)*1*3", "(1+6)*3+3", "(1*3)+3*7", "(1+8)*3-3", "(1*3)*9-3",
  "(4+4)*1*3", "(1+3)+4*5", "(1+3)*7-4", "(1+3)*4+8", "(1+4)*3+9", "(1+5)+3*6", "(1+8)+3*5", "(1*3)*5+9",
  "(1*3)*6+6", "(3*6)-1+7", "(6-3)*1*8", "(1+9)*3-6", "(1+7)/3*9", "(1+3)*8-8", "(1/3)*8*9", "(9-1)/3*9",
  "(1+4)*4+4", "(1*4)+4*5", "(1+6)*4-4", "(1*4)*7-4", "(1*4)*4+8", "(4*4)-1+9", "(4*5)-1+5", "(1-5)+4*7",
  "(5-1)*4+8", "(4-1)*5+9", "(1+4)*6-6", "(8-4)*1*6", "(1+7)*4-8", "(1*4)*8-8", "(1-9)+4*8", "(1+5)*5-6",
  "(1*5)*6-6", "(1-7)+5*6", "(9-5)*1*6", "(5-1)*8-8", "(1+5)+9+9", "(6-1)*6-6", "(1+6)+8+9", "(1*6)+9+9",
  "(1+7)+7+9", "(1+7)+8+8", "(1*7)+8+9", "(7-1)+9+9", "(1*8)+8+8", "(8-1)+8+9", "(2+2)*2*3", "(2+4)*2*2",
  "(8-2)*2*2", "(2+9)*2+2", "(3+3)*2*2", "(6-2)*2*3", "(2-2)+3*8", "(2*3)+2*9", "(2+2)+4*5", "(2-2)+4*6",
  "(2+2)*7-4", "(2+2)*4+8", "(2+4)+2*9", "(5*5)-2/2", "(5+6)*2+2", "(2*5)+2*7", "(5+8)*2-2", "(2+6)/2*6",
  "(2+7)*2+6", "(2+6)+2*8", "(2*7)+2+8", "(2+2)*8-8", "(2*9)-2+8", "(2+5)*3+3", "(2*3)+3*6", "(2+7)*3-3",
  "(3-2)*3*8", "(2+3)*3+9", "(2+3)*4+4", "(2+4)+3*6", "(3+7)*2+4", "(8-4)*2*3", "(2/3)*4*9", "(2-3)+5*5",
  "(2*3)*5-6", "(2+7)+3*5", "(2*8)+3+5", "(2-5)+3*9", "(2+3)*6-6", "(3*7)+6/2", "(2+8)*3-6", "(2+6)/3*9",
  "(2*7)+3+7", "(2+7)/3*8", "(7-2)*3+9", "(8+8)/2*3", "(9-3)/2*8", "(2*3)+9+9", "(2*4)+4*4", "(2+5)*4-4",
  "(2+6)+4*4", "(7-2)*4+4", "(2*4)*4-8", "(9-2)*4-4", "(5+5)*2+4", "(2+4)*5-6", "(5+7)/2*4", "(4*5)+8/2",
  "(5+9)*2-4", "(6-4)*2*6", "(2-6)+4*7", "(2/4)*6*8", "(4-2)*9+6", "(7+7)*2-4", "(4*7)-8/2", "(2*4)+7+9",
  "(2*4)+8+8", "(2+4)+9+9", "(2*7)+5+5", "(2*5)+5+9", "(5-2)*6+6", "(2*6)+5+7", "(2*5)+6+8", "(5/2)*6+9",
  "(2*5)+7+7", "(5*7)-2-9", "(5*8)-2*8", "(2+5)+8+9", "(2*6)+6+6", "(7-2)*6-6", "(8-6)*2*6", "(6+9)*2-6",
  "(7+8)*2-6", "(2+6)+7+9", "(2+6)+8+8", "(2/6)*8*9", "(2+7)+7+8", "(7+9)*2-8", "(8/2)*8-8", "(8-2)+9+9",
  "(3*3)*3-3", "(3+4)*3+3", "(3*3)+3*5", "(3+3)+3*6", "(3-3)+3*8", "(3*4)+3*4", "(4+5)*3-3", "(3-3)+4*6",
  "(4-3)*3*8", "(3*4)+3+9", "(5*5)-3/3", "(3+3)*5-6", "(3+5)/3*9", "(3+7)*3-6", "(3+6)/3*8", "(3*3)+6+9",
  "(3*3)+7+8", "(3*7)+9/3", "(3+8)*3-9", "(3+3)+9+9", "(3+4)*4-4", "(3+5)+4*4", "(4-3)*4*6", "(3*4)+4+8",
  "(4+4)/3*9", "(3-4)+5*5", "(3*4)+5+7", "(3+5)*4-8", "(3*4)+6+6", "(4+8)/3*6", "(3-7)+4*7", "(7-3)*4+8",
  "(3*9)+4-7", "(3+4)+8+9", "(4*9)-3-9", "(5+5)*3-6", "(3*5)/5*8", "(5+7)/3*6", "(6-5)*3*8", "(3-9)+5*6",
  "(3*7)-5+8", "(3+5)+7+9", "(3+5)+8+8", "(3*9)+5-8", "(5/3)*9+9", "(6-3)*6+6", "(6*7)-3*6", "(3*6)/6*8",
  "(3+6)+6+9", "(3+6)+7+8", "(3*7)-6+9", "(6/3)*8+8", "(3*9)+6-9", "(3+7)+7+7", "(3*7)/7*8", "(7-3)*8-8",
  "(3*8)+8-8", "(9-8)*3*8", "(3*8)+9-9", "(9-3)+9+9", "(4+4)+4*4", "(4-4)+4*6", "(4+4)*4-8", "(9-4)*4+4",
  "(5*5)-4/4", "(5-4)*4*6", "(4*5)-4+8", "(4*4)/6*9", "(4*7)+4-8", "(4+4)+7+9", "(4+4)+8+8", "(4*9)-4-8",
  "(4-5)+5*5", "(4*5)/5*6", "(4*5)-5+9", "(6-5)*4*6", "(4+5)+6+9", "(5*7)-4-7", "(4+5)+7+8", "(4*7)+5-9",
  "(9-5)*4+8", "(4*6)+6-6", "(7-4)*6+6", "(4+6)+6+8", "(4*9)-6-6", "(4+6)+7+7", "(8-7)*4*6", "(7+9)/4*6",
  "(4*6)+8-8", "(8/4)*9+6", "(4*6)+9-9", "(7*8)-4*8", "(8-4)*8-8", "(5*5)-5/5", "(5*5)+5-6", "(5+5)+5+9",
  "(5*5)-6/6", "(5*5)+6-7", "(5+5)+6+8", "(5+5)+7+7", "(5*5)+7-8", "(5*5)-8/8", "(5*5)+8-9", "(5*5)-9/9",
  "(5+6)+6+7", "(8-5)*6+6", "(6*9)-5*6", "(7-5)*9+6", "(6+9)/5*8", "(9-6)*5+9", "(7-5)*8+8", "(5*8)-7-9",
  "(5*8)-8-8", "(9-5)*8-8", "(6+6)+6+6", "(6*6)*6/9", "(8-6)*9+6", "(6*7)-9-9", "(8-6)*8+8", "(8+8)/6*9",
  "(9+9)/6*8", "(9-7)*8+8"
};

void setup() {
  Serial.begin(9600);
  Serial.println((__FlashStringHelper*)cards[random(306)]); //print a random string from the cards array
  Serial.println((__FlashStringHelper*)solutions[random(306)]); //print a random string from solutions array
}

void loop() {
}

String takes up more space -- you don't need 612 of them.

You can take any single char array or char * and turn it into a String if you really have to, but most likely you don't. There are equivalent "C-string" functions for most things. The names pretty much all start with str, like strlen and strncmp.

Looking to reduce it further, you only need the solutions. You can extract the digits, sort them, and display them with commas in-between as the cards. It's easier since each has exactly four single-digits.

char cardBuf[] = "1,2,3,4";

void swapGreater(int i) {
  char c = cardBuf[i];
  if (c > cardBuf[i + 2]) {
    cardBuf[i] = cardBuf[i + 2];
    cardBuf[i + 2] = c;
  }
}

void extractCard(const char *solution) {
  int i = 0;
  while (char c = *solution++) {
    if (c >= '0' && c <= '9') {
      cardBuf[i] = c;
      i += 2;
    }
  }
  // bubble sort
  swapGreater(4);
  swapGreater(2);
  swapGreater(0);
  swapGreater(4);
  swapGreater(2);
  swapGreater(4);
}

const char * solutions[] = {"(1+3)*1*6", "(9-7)*8+8"};
constexpr size_t num_solutions = sizeof(solutions) / sizeof(solutions[0]);

void setup() {
  Serial.begin(115200);
  for (unsigned i = 0; i < num_solutions; i++) {
    extractCard(solutions[i]);
    Serial.println(cardBuf);
  }
}

void loop() {}

That saves about 2KB.

I will try this implementation, thanks so much!

That's a big memory save, thanks so much!

This helped me realize just how big my lists were getting.

At least this isn't one of the other lists I made with my program, my other list was 0.93376 megabytes... and I got a 'page not responding' when I wrote the value to the console log :slight_smile:

I finally got around to implementing your solution (I have been really busy recently so I didn't have time for a while), but when using just the list of solutions I still get the error about reducing footprint. The post @david_2018 made mentions that the solutions array uses 3060 bytes, and the Arduino uno only has 2048 bytes of ram.

I just tested out your code and it seems to work really well. One issue though: since it is hard to get good random numbers in Arduino, the first random number that seems to be selected is always 283 for this project. Any ideas on how to make this more random (hopefully without any libraries that I would need to download)? The first thing that comes to my mind would be to just repeatedly generate a 'random' number 1 time per void loop, which would hopefully make it harder to predict what number is next. Here is the code (I also added some stuff related to LCD displays, but that shouldn't mess up the rest of the code):

//The liquid crystal display is gonna be used to display the cards,
// so feel free to ignore it.
// LiquidCrystal(RS, E, D4, D5, D6, D7)
#include <LiquidCrystal.h>

#define D4 4
#define D5 5
#define D6 6
#define D7 7
#define E 8
#define RS 9

LiquidCrystal LCD(RS, E, D4, D5, D6, D7);  
int random_pos = 0;
String card_to_display = "5,5,7,7";
const char cards[306][9] PROGMEM = {
  "1,1,2,6", "1,1,2,8", "1,1,3,4", "1,1,3,6", "1,1,3,7", "1,1,3,8", "1,1,3,9", "1,1,4,5",
  "1,1,4,6", "1,1,4,7", "1,1,4,8", "1,1,5,5", "1,1,5,6", "1,1,6,9", "1,1,8,8", "1,2,2,4",
  "1,2,2,5", "1,2,2,6", "1,2,2,7", "1,2,3,3", "1,2,3,4", "1,2,3,5", "1,2,3,6", "1,2,3,7",
  "1,2,3,8", "1,2,3,9", "1,2,4,4", "1,2,4,6", "1,2,4,8", "1,2,4,9", "1,2,5,5", "1,2,5,7",
  "1,2,5,8", "1,2,5,9", "1,2,6,6", "1,2,6,7", "1,2,6,8", "1,2,6,9", "1,2,7,8", "1,2,7,9",
  "1,2,8,8", "1,2,8,9", "1,3,3,4", "1,3,3,5", "1,3,3,6", "1,3,3,7", "1,3,3,8", "1,3,3,9",
  "1,3,4,4", "1,3,4,5", "1,3,4,7", "1,3,4,8", "1,3,4,9", "1,3,5,6", "1,3,5,8", "1,3,5,9",
  "1,3,6,6", "1,3,6,7", "1,3,6,8", "1,3,6,9", "1,3,7,9", "1,3,8,8", "1,3,8,9", "1,3,9,9",
  "1,4,4,4", "1,4,4,5", "1,4,4,6", "1,4,4,7", "1,4,4,8", "1,4,4,9", "1,4,5,5", "1,4,5,7",
  "1,4,5,8", "1,4,5,9", "1,4,6,6", "1,4,6,8", "1,4,7,8", "1,4,8,8", "1,4,8,9", "1,5,5,6",
  "1,5,6,6", "1,5,6,7", "1,5,6,9", "1,5,8,8", "1,5,9,9", "1,6,6,6", "1,6,8,9", "1,6,9,9",
  "1,7,7,9", "1,7,8,8", "1,7,8,9", "1,7,9,9", "1,8,8,8", "1,8,8,9", "2,2,2,3", "2,2,2,4",
  "2,2,2,8", "2,2,2,9", "2,2,3,3", "2,2,3,6", "2,2,3,8", "2,2,3,9", "2,2,4,5", "2,2,4,6",
  "2,2,4,7", "2,2,4,8", "2,2,4,9", "2,2,5,5", "2,2,5,6", "2,2,5,7", "2,2,5,8", "2,2,6,6",
  "2,2,6,7", "2,2,6,8", "2,2,7,8", "2,2,8,8", "2,2,8,9", "2,3,3,5", "2,3,3,6", "2,3,3,7",
  "2,3,3,8", "2,3,3,9", "2,3,4,4", "2,3,4,6", "2,3,4,7", "2,3,4,8", "2,3,4,9", "2,3,5,5",
  "2,3,5,6", "2,3,5,7", "2,3,5,8", "2,3,5,9", "2,3,6,6", "2,3,6,7", "2,3,6,8", "2,3,6,9",
  "2,3,7,7", "2,3,7,8", "2,3,7,9", "2,3,8,8", "2,3,8,9", "2,3,9,9", "2,4,4,4", "2,4,4,5",
  "2,4,4,6", "2,4,4,7", "2,4,4,8", "2,4,4,9", "2,4,5,5", "2,4,5,6", "2,4,5,7", "2,4,5,8",
  "2,4,5,9", "2,4,6,6", "2,4,6,7", "2,4,6,8", "2,4,6,9", "2,4,7,7", "2,4,7,8", "2,4,7,9",
  "2,4,8,8", "2,4,9,9", "2,5,5,7", "2,5,5,9", "2,5,6,6", "2,5,6,7", "2,5,6,8", "2,5,6,9",
  "2,5,7,7", "2,5,7,9", "2,5,8,8", "2,5,8,9", "2,6,6,6", "2,6,6,7", "2,6,6,8", "2,6,6,9",
  "2,6,7,8", "2,6,7,9", "2,6,8,8", "2,6,8,9", "2,7,7,8", "2,7,8,9", "2,8,8,8", "2,8,9,9",
  "3,3,3,3", "3,3,3,4", "3,3,3,5", "3,3,3,6", "3,3,3,8", "3,3,4,4", "3,3,4,5", "3,3,4,6",
  "3,3,4,8", "3,3,4,9", "3,3,5,5", "3,3,5,6", "3,3,5,9", "3,3,6,7", "3,3,6,8", "3,3,6,9",
  "3,3,7,8", "3,3,7,9", "3,3,8,9", "3,3,9,9", "3,4,4,4", "3,4,4,5", "3,4,4,6", "3,4,4,8",
  "3,4,4,9", "3,4,5,5", "3,4,5,7", "3,4,5,8", "3,4,6,6", "3,4,6,8", "3,4,7,7", "3,4,7,8",
  "3,4,7,9", "3,4,8,9", "3,4,9,9", "3,5,5,6", "3,5,5,8", "3,5,6,7", "3,5,6,8", "3,5,6,9",
  "3,5,7,8", "3,5,7,9", "3,5,8,8", "3,5,8,9", "3,5,9,9", "3,6,6,6", "3,6,6,7", "3,6,6,8",
  "3,6,6,9", "3,6,7,8", "3,6,7,9", "3,6,8,8", "3,6,9,9", "3,7,7,7", "3,7,7,8", "3,7,8,8",
  "3,8,8,8", "3,8,8,9", "3,8,9,9", "3,9,9,9", "4,4,4,4", "4,4,4,6", "4,4,4,8", "4,4,4,9",
  "4,4,5,5", "4,4,5,6", "4,4,5,8", "4,4,6,9", "4,4,7,8", "4,4,7,9", "4,4,8,8", "4,4,8,9",
  "4,5,5,5", "4,5,5,6", "4,5,5,9", "4,5,6,6", "4,5,6,9", "4,5,7,7", "4,5,7,8", "4,5,7,9",
  "4,5,8,9", "4,6,6,6", "4,6,6,7", "4,6,6,8", "4,6,6,9", "4,6,7,7", "4,6,7,8", "4,6,7,9",
  "4,6,8,8", "4,6,8,9", "4,6,9,9", "4,7,8,8", "4,8,8,8", "5,5,5,5", "5,5,5,6", "5,5,5,9",
  "5,5,6,6", "5,5,6,7", "5,5,6,8", "5,5,7,7", "5,5,7,8", "5,5,8,8", "5,5,8,9", "5,5,9,9",
  "5,6,6,7", "5,6,6,8", "5,6,6,9", "5,6,7,9", "5,6,8,9", "5,6,9,9", "5,7,8,8", "5,7,8,9",
  "5,8,8,8", "5,8,8,9", "6,6,6,6", "6,6,6,9", "6,6,8,9", "6,7,9,9", "6,8,8,8", "6,8,8,9",
  "6,8,9,9", "7,8,8,9"};

const char solutions[306][10] PROGMEM = {
  "(1+1)*2*6", "(1+2)*1*8", "(1+1)*3*4", "(1+3)*1*6", "(1+7)*1*3", "(1-1)+3*8", "(9-1)*1*3", "(1+4)*5-1",
  "(1-1)+4*6", "(7-1)*1*4", "(4-1)*1*8", "(1*5)*5-1", "(5-1)*1*6", "(1+1)*9+6", "(1+1)*8+8", "(1+2)*2*4",
  "(1+5)*2*2", "(1*2)*2*6", "(7-1)*2*2", "(1+3)*2*3", "(1*2)*3*4", "(2+3)*5-1", "(2+6)*1*3", "(1+2)+3*7",
  "(2-1)*3*8", "(1+2)*9-3", "(2+4)*1*4", "(2-1)*4*6", "(4+8)*1*2", "(1+9)*2+4", "(1-2)+5*5", "(5+7)*1*2",
  "(1+5)/2*8", "(1+2)*5+9", "(1+2)*6+6", "(1+7)/2*6", "(1/2)*6*8", "(1*2)*9+6", "(1+7)+2*8", "(1+9)+2*7",
  "(1*2)*8+8", "(2*8)-1+9", "(3-1)*3*4", "(3+5)*1*3", "(1+6)*3+3", "(1*3)+3*7", "(1+8)*3-3", "(1*3)*9-3",
  "(4+4)*1*3", "(1+3)+4*5", "(1+3)*7-4", "(1+3)*4+8", "(1+4)*3+9", "(1+5)+3*6", "(1+8)+3*5", "(1*3)*5+9",
  "(1*3)*6+6", "(3*6)-1+7", "(6-3)*1*8", "(1+9)*3-6", "(1+7)/3*9", "(1+3)*8-8", "(1/3)*8*9", "(9-1)/3*9",
  "(1+4)*4+4", "(1*4)+4*5", "(1+6)*4-4", "(1*4)*7-4", "(1*4)*4+8", "(4*4)-1+9", "(4*5)-1+5", "(1-5)+4*7",
  "(5-1)*4+8", "(4-1)*5+9", "(1+4)*6-6", "(8-4)*1*6", "(1+7)*4-8", "(1*4)*8-8", "(1-9)+4*8", "(1+5)*5-6",
  "(1*5)*6-6", "(1-7)+5*6", "(9-5)*1*6", "(5-1)*8-8", "(1+5)+9+9", "(6-1)*6-6", "(1+6)+8+9", "(1*6)+9+9",
  "(1+7)+7+9", "(1+7)+8+8", "(1*7)+8+9", "(7-1)+9+9", "(1*8)+8+8", "(8-1)+8+9", "(2+2)*2*3", "(2+4)*2*2",
  "(8-2)*2*2", "(2+9)*2+2", "(3+3)*2*2", "(6-2)*2*3", "(2-2)+3*8", "(2*3)+2*9", "(2+2)+4*5", "(2-2)+4*6",
  "(2+2)*7-4", "(2+2)*4+8", "(2+4)+2*9", "(5*5)-2/2", "(5+6)*2+2", "(2*5)+2*7", "(5+8)*2-2", "(2+6)/2*6",
  "(2+7)*2+6", "(2+6)+2*8", "(2*7)+2+8", "(2+2)*8-8", "(2*9)-2+8", "(2+5)*3+3", "(2*3)+3*6", "(2+7)*3-3",
  "(3-2)*3*8", "(2+3)*3+9", "(2+3)*4+4", "(2+4)+3*6", "(3+7)*2+4", "(8-4)*2*3", "(2/3)*4*9", "(2-3)+5*5",
  "(2*3)*5-6", "(2+7)+3*5", "(2*8)+3+5", "(2-5)+3*9", "(2+3)*6-6", "(3*7)+6/2", "(2+8)*3-6", "(2+6)/3*9",
  "(2*7)+3+7", "(2+7)/3*8", "(7-2)*3+9", "(8+8)/2*3", "(9-3)/2*8", "(2*3)+9+9", "(2*4)+4*4", "(2+5)*4-4",
  "(2+6)+4*4", "(7-2)*4+4", "(2*4)*4-8", "(9-2)*4-4", "(5+5)*2+4", "(2+4)*5-6", "(5+7)/2*4", "(4*5)+8/2",
  "(5+9)*2-4", "(6-4)*2*6", "(2-6)+4*7", "(2/4)*6*8", "(4-2)*9+6", "(7+7)*2-4", "(4*7)-8/2", "(2*4)+7+9",
  "(2*4)+8+8", "(2+4)+9+9", "(2*7)+5+5", "(2*5)+5+9", "(5-2)*6+6", "(2*6)+5+7", "(2*5)+6+8", "(5/2)*6+9",
  "(2*5)+7+7", "(5*7)-2-9", "(5*8)-2*8", "(2+5)+8+9", "(2*6)+6+6", "(7-2)*6-6", "(8-6)*2*6", "(6+9)*2-6",
  "(7+8)*2-6", "(2+6)+7+9", "(2+6)+8+8", "(2/6)*8*9", "(2+7)+7+8", "(7+9)*2-8", "(8/2)*8-8", "(8-2)+9+9",
  "(3*3)*3-3", "(3+4)*3+3", "(3*3)+3*5", "(3+3)+3*6", "(3-3)+3*8", "(3*4)+3*4", "(4+5)*3-3", "(3-3)+4*6",
  "(4-3)*3*8", "(3*4)+3+9", "(5*5)-3/3", "(3+3)*5-6", "(3+5)/3*9", "(3+7)*3-6", "(3+6)/3*8", "(3*3)+6+9",
  "(3*3)+7+8", "(3*7)+9/3", "(3+8)*3-9", "(3+3)+9+9", "(3+4)*4-4", "(3+5)+4*4", "(4-3)*4*6", "(3*4)+4+8",
  "(4+4)/3*9", "(3-4)+5*5", "(3*4)+5+7", "(3+5)*4-8", "(3*4)+6+6", "(4+8)/3*6", "(3-7)+4*7", "(7-3)*4+8",
  "(3*9)+4-7", "(3+4)+8+9", "(4*9)-3-9", "(5+5)*3-6", "(3*5)/5*8", "(5+7)/3*6", "(6-5)*3*8", "(3-9)+5*6",
  "(3*7)-5+8", "(3+5)+7+9", "(3+5)+8+8", "(3*9)+5-8", "(5/3)*9+9", "(6-3)*6+6", "(6*7)-3*6", "(3*6)/6*8",
  "(3+6)+6+9", "(3+6)+7+8", "(3*7)-6+9", "(6/3)*8+8", "(3*9)+6-9", "(3+7)+7+7", "(3*7)/7*8", "(7-3)*8-8",
  "(3*8)+8-8", "(9-8)*3*8", "(3*8)+9-9", "(9-3)+9+9", "(4+4)+4*4", "(4-4)+4*6", "(4+4)*4-8", "(9-4)*4+4",
  "(5*5)-4/4", "(5-4)*4*6", "(4*5)-4+8", "(4*4)/6*9", "(4*7)+4-8", "(4+4)+7+9", "(4+4)+8+8", "(4*9)-4-8",
  "(4-5)+5*5", "(4*5)/5*6", "(4*5)-5+9", "(6-5)*4*6", "(4+5)+6+9", "(5*7)-4-7", "(4+5)+7+8", "(4*7)+5-9",
  "(9-5)*4+8", "(4*6)+6-6", "(7-4)*6+6", "(4+6)+6+8", "(4*9)-6-6", "(4+6)+7+7", "(8-7)*4*6", "(7+9)/4*6",
  "(4*6)+8-8", "(8/4)*9+6", "(4*6)+9-9", "(7*8)-4*8", "(8-4)*8-8", "(5*5)-5/5", "(5*5)+5-6", "(5+5)+5+9",
  "(5*5)-6/6", "(5*5)+6-7", "(5+5)+6+8", "(5+5)+7+7", "(5*5)+7-8", "(5*5)-8/8", "(5*5)+8-9", "(5*5)-9/9",
  "(5+6)+6+7", "(8-5)*6+6", "(6*9)-5*6", "(7-5)*9+6", "(6+9)/5*8", "(9-6)*5+9", "(7-5)*8+8", "(5*8)-7-9",
  "(5*8)-8-8", "(9-5)*8-8", "(6+6)+6+6", "(6*6)*6/9", "(8-6)*9+6", "(6*7)-9-9", "(8-6)*8+8", "(8+8)/6*9",
  "(9+9)/6*8", "(9-7)*8+8"};

void setup() {
  LCD.begin(16,2); 
  Serial.begin(9600);
  random_pos = random(306);
    //I added the serial print below to help with the post
  Serial.println(random_pos); 
  Serial.println((__FlashStringHelper*)cards[random_pos]); //print a random string from the cards array
  Serial.println((__FlashStringHelper*)solutions[random_pos]); //print a random string from solutions array
  card_to_display = ((__FlashStringHelper*)cards[random_pos]);
  Serial.println(card_to_display); 
}
 
void loop() {
    random_pos = random(306);
	LCD.print("Your card is:");
    LCD.setCursor(0, 1);
  	LCD.print(card_to_display);
  	delay(5000);
  	LCD.clear();
}

Add a randomSeed(). See https://docs.arduino.cc/language-reference/en/functions/random-numbers/randomSeed/.

Note that the example does not give an perfect value to for the seed. A better way could be to have a start button that the user must push and use the millis() (when that button is pushed) as the seed.

a)
I can't help myself, but a string/char array with numbers looks odd to me:

why is there a need to store 4 numbers, 3 commas and the nulllimiter 306 times?

b)

if the two arrays are in relation and share so much similarity, why do you need "cards" at all?
Just use solutions and leave away any brackets and operators and display the numbers from the array separated by commas. In my opinion you don't need cards at all.

(like kenb4 already mentioned already 17 days ago).

@noiasca I had tested out the solution @kenb4 mentioned, but the solutions array was still too large for the program to run. By using @david_2018's idea of storing the arrays with PROGMEM there is space to store the arrays. I guess I could still save memory by removing the card array and then extracting the cards from the solutions, but that adds complexity and I want to get it working before adding a bunch of optimisations.

When I put randomSeed(analogRead(0)); into Tinkercad it gives me the error message: 12:11: error: expected constructor, destructor, or type conversion before '(' token

Here is my code, since I added some stuff:

//The liquid crystal display is gonna be used to display the cards,
// so feel free to ignore it.
// LiquidCrystal(RS, E, D4, D5, D6, D7)
#include <LiquidCrystal.h>
//use millis at time a new thing is generated for rand seed?
#define D4 4
#define D5 5
#define D6 6
#define D7 7
#define E 8
#define RS 9
randomSeed(analogRead(0));

LiquidCrystal LCD(RS, E, D4, D5, D6, D7);  
int random_pos = 0;
String card_to_display = "5,5,7,7";
const char cards[306][9] PROGMEM = {
  "1,1,2,6", "1,1,2,8", "1,1,3,4", "1,1,3,6", "1,1,3,7", "1,1,3,8", "1,1,3,9", "1,1,4,5",
  "1,1,4,6", "1,1,4,7", "1,1,4,8", "1,1,5,5", "1,1,5,6", "1,1,6,9", "1,1,8,8", "1,2,2,4",
  "1,2,2,5", "1,2,2,6", "1,2,2,7", "1,2,3,3", "1,2,3,4", "1,2,3,5", "1,2,3,6", "1,2,3,7",
  "1,2,3,8", "1,2,3,9", "1,2,4,4", "1,2,4,6", "1,2,4,8", "1,2,4,9", "1,2,5,5", "1,2,5,7",
  "1,2,5,8", "1,2,5,9", "1,2,6,6", "1,2,6,7", "1,2,6,8", "1,2,6,9", "1,2,7,8", "1,2,7,9",
  "1,2,8,8", "1,2,8,9", "1,3,3,4", "1,3,3,5", "1,3,3,6", "1,3,3,7", "1,3,3,8", "1,3,3,9",
  "1,3,4,4", "1,3,4,5", "1,3,4,7", "1,3,4,8", "1,3,4,9", "1,3,5,6", "1,3,5,8", "1,3,5,9",
  "1,3,6,6", "1,3,6,7", "1,3,6,8", "1,3,6,9", "1,3,7,9", "1,3,8,8", "1,3,8,9", "1,3,9,9",
  "1,4,4,4", "1,4,4,5", "1,4,4,6", "1,4,4,7", "1,4,4,8", "1,4,4,9", "1,4,5,5", "1,4,5,7",
  "1,4,5,8", "1,4,5,9", "1,4,6,6", "1,4,6,8", "1,4,7,8", "1,4,8,8", "1,4,8,9", "1,5,5,6",
  "1,5,6,6", "1,5,6,7", "1,5,6,9", "1,5,8,8", "1,5,9,9", "1,6,6,6", "1,6,8,9", "1,6,9,9",
  "1,7,7,9", "1,7,8,8", "1,7,8,9", "1,7,9,9", "1,8,8,8", "1,8,8,9", "2,2,2,3", "2,2,2,4",
  "2,2,2,8", "2,2,2,9", "2,2,3,3", "2,2,3,6", "2,2,3,8", "2,2,3,9", "2,2,4,5", "2,2,4,6",
  "2,2,4,7", "2,2,4,8", "2,2,4,9", "2,2,5,5", "2,2,5,6", "2,2,5,7", "2,2,5,8", "2,2,6,6",
  "2,2,6,7", "2,2,6,8", "2,2,7,8", "2,2,8,8", "2,2,8,9", "2,3,3,5", "2,3,3,6", "2,3,3,7",
  "2,3,3,8", "2,3,3,9", "2,3,4,4", "2,3,4,6", "2,3,4,7", "2,3,4,8", "2,3,4,9", "2,3,5,5",
  "2,3,5,6", "2,3,5,7", "2,3,5,8", "2,3,5,9", "2,3,6,6", "2,3,6,7", "2,3,6,8", "2,3,6,9",
  "2,3,7,7", "2,3,7,8", "2,3,7,9", "2,3,8,8", "2,3,8,9", "2,3,9,9", "2,4,4,4", "2,4,4,5",
  "2,4,4,6", "2,4,4,7", "2,4,4,8", "2,4,4,9", "2,4,5,5", "2,4,5,6", "2,4,5,7", "2,4,5,8",
  "2,4,5,9", "2,4,6,6", "2,4,6,7", "2,4,6,8", "2,4,6,9", "2,4,7,7", "2,4,7,8", "2,4,7,9",
  "2,4,8,8", "2,4,9,9", "2,5,5,7", "2,5,5,9", "2,5,6,6", "2,5,6,7", "2,5,6,8", "2,5,6,9",
  "2,5,7,7", "2,5,7,9", "2,5,8,8", "2,5,8,9", "2,6,6,6", "2,6,6,7", "2,6,6,8", "2,6,6,9",
  "2,6,7,8", "2,6,7,9", "2,6,8,8", "2,6,8,9", "2,7,7,8", "2,7,8,9", "2,8,8,8", "2,8,9,9",
  "3,3,3,3", "3,3,3,4", "3,3,3,5", "3,3,3,6", "3,3,3,8", "3,3,4,4", "3,3,4,5", "3,3,4,6",
  "3,3,4,8", "3,3,4,9", "3,3,5,5", "3,3,5,6", "3,3,5,9", "3,3,6,7", "3,3,6,8", "3,3,6,9",
  "3,3,7,8", "3,3,7,9", "3,3,8,9", "3,3,9,9", "3,4,4,4", "3,4,4,5", "3,4,4,6", "3,4,4,8",
  "3,4,4,9", "3,4,5,5", "3,4,5,7", "3,4,5,8", "3,4,6,6", "3,4,6,8", "3,4,7,7", "3,4,7,8",
  "3,4,7,9", "3,4,8,9", "3,4,9,9", "3,5,5,6", "3,5,5,8", "3,5,6,7", "3,5,6,8", "3,5,6,9",
  "3,5,7,8", "3,5,7,9", "3,5,8,8", "3,5,8,9", "3,5,9,9", "3,6,6,6", "3,6,6,7", "3,6,6,8",
  "3,6,6,9", "3,6,7,8", "3,6,7,9", "3,6,8,8", "3,6,9,9", "3,7,7,7", "3,7,7,8", "3,7,8,8",
  "3,8,8,8", "3,8,8,9", "3,8,9,9", "3,9,9,9", "4,4,4,4", "4,4,4,6", "4,4,4,8", "4,4,4,9",
  "4,4,5,5", "4,4,5,6", "4,4,5,8", "4,4,6,9", "4,4,7,8", "4,4,7,9", "4,4,8,8", "4,4,8,9",
  "4,5,5,5", "4,5,5,6", "4,5,5,9", "4,5,6,6", "4,5,6,9", "4,5,7,7", "4,5,7,8", "4,5,7,9",
  "4,5,8,9", "4,6,6,6", "4,6,6,7", "4,6,6,8", "4,6,6,9", "4,6,7,7", "4,6,7,8", "4,6,7,9",
  "4,6,8,8", "4,6,8,9", "4,6,9,9", "4,7,8,8", "4,8,8,8", "5,5,5,5", "5,5,5,6", "5,5,5,9",
  "5,5,6,6", "5,5,6,7", "5,5,6,8", "5,5,7,7", "5,5,7,8", "5,5,8,8", "5,5,8,9", "5,5,9,9",
  "5,6,6,7", "5,6,6,8", "5,6,6,9", "5,6,7,9", "5,6,8,9", "5,6,9,9", "5,7,8,8", "5,7,8,9",
  "5,8,8,8", "5,8,8,9", "6,6,6,6", "6,6,6,9", "6,6,8,9", "6,7,9,9", "6,8,8,8", "6,8,8,9",
  "6,8,9,9", "7,8,8,9"};

const char solutions[306][10] PROGMEM = {
  "(1+1)*2*6", "(1+2)*1*8", "(1+1)*3*4", "(1+3)*1*6", "(1+7)*1*3", "(1-1)+3*8", "(9-1)*1*3", "(1+4)*5-1",
  "(1-1)+4*6", "(7-1)*1*4", "(4-1)*1*8", "(1*5)*5-1", "(5-1)*1*6", "(1+1)*9+6", "(1+1)*8+8", "(1+2)*2*4",
  "(1+5)*2*2", "(1*2)*2*6", "(7-1)*2*2", "(1+3)*2*3", "(1*2)*3*4", "(2+3)*5-1", "(2+6)*1*3", "(1+2)+3*7",
  "(2-1)*3*8", "(1+2)*9-3", "(2+4)*1*4", "(2-1)*4*6", "(4+8)*1*2", "(1+9)*2+4", "(1-2)+5*5", "(5+7)*1*2",
  "(1+5)/2*8", "(1+2)*5+9", "(1+2)*6+6", "(1+7)/2*6", "(1/2)*6*8", "(1*2)*9+6", "(1+7)+2*8", "(1+9)+2*7",
  "(1*2)*8+8", "(2*8)-1+9", "(3-1)*3*4", "(3+5)*1*3", "(1+6)*3+3", "(1*3)+3*7", "(1+8)*3-3", "(1*3)*9-3",
  "(4+4)*1*3", "(1+3)+4*5", "(1+3)*7-4", "(1+3)*4+8", "(1+4)*3+9", "(1+5)+3*6", "(1+8)+3*5", "(1*3)*5+9",
  "(1*3)*6+6", "(3*6)-1+7", "(6-3)*1*8", "(1+9)*3-6", "(1+7)/3*9", "(1+3)*8-8", "(1/3)*8*9", "(9-1)/3*9",
  "(1+4)*4+4", "(1*4)+4*5", "(1+6)*4-4", "(1*4)*7-4", "(1*4)*4+8", "(4*4)-1+9", "(4*5)-1+5", "(1-5)+4*7",
  "(5-1)*4+8", "(4-1)*5+9", "(1+4)*6-6", "(8-4)*1*6", "(1+7)*4-8", "(1*4)*8-8", "(1-9)+4*8", "(1+5)*5-6",
  "(1*5)*6-6", "(1-7)+5*6", "(9-5)*1*6", "(5-1)*8-8", "(1+5)+9+9", "(6-1)*6-6", "(1+6)+8+9", "(1*6)+9+9",
  "(1+7)+7+9", "(1+7)+8+8", "(1*7)+8+9", "(7-1)+9+9", "(1*8)+8+8", "(8-1)+8+9", "(2+2)*2*3", "(2+4)*2*2",
  "(8-2)*2*2", "(2+9)*2+2", "(3+3)*2*2", "(6-2)*2*3", "(2-2)+3*8", "(2*3)+2*9", "(2+2)+4*5", "(2-2)+4*6",
  "(2+2)*7-4", "(2+2)*4+8", "(2+4)+2*9", "(5*5)-2/2", "(5+6)*2+2", "(2*5)+2*7", "(5+8)*2-2", "(2+6)/2*6",
  "(2+7)*2+6", "(2+6)+2*8", "(2*7)+2+8", "(2+2)*8-8", "(2*9)-2+8", "(2+5)*3+3", "(2*3)+3*6", "(2+7)*3-3",
  "(3-2)*3*8", "(2+3)*3+9", "(2+3)*4+4", "(2+4)+3*6", "(3+7)*2+4", "(8-4)*2*3", "(2/3)*4*9", "(2-3)+5*5",
  "(2*3)*5-6", "(2+7)+3*5", "(2*8)+3+5", "(2-5)+3*9", "(2+3)*6-6", "(3*7)+6/2", "(2+8)*3-6", "(2+6)/3*9",
  "(2*7)+3+7", "(2+7)/3*8", "(7-2)*3+9", "(8+8)/2*3", "(9-3)/2*8", "(2*3)+9+9", "(2*4)+4*4", "(2+5)*4-4",
  "(2+6)+4*4", "(7-2)*4+4", "(2*4)*4-8", "(9-2)*4-4", "(5+5)*2+4", "(2+4)*5-6", "(5+7)/2*4", "(4*5)+8/2",
  "(5+9)*2-4", "(6-4)*2*6", "(2-6)+4*7", "(2/4)*6*8", "(4-2)*9+6", "(7+7)*2-4", "(4*7)-8/2", "(2*4)+7+9",
  "(2*4)+8+8", "(2+4)+9+9", "(2*7)+5+5", "(2*5)+5+9", "(5-2)*6+6", "(2*6)+5+7", "(2*5)+6+8", "(5/2)*6+9",
  "(2*5)+7+7", "(5*7)-2-9", "(5*8)-2*8", "(2+5)+8+9", "(2*6)+6+6", "(7-2)*6-6", "(8-6)*2*6", "(6+9)*2-6",
  "(7+8)*2-6", "(2+6)+7+9", "(2+6)+8+8", "(2/6)*8*9", "(2+7)+7+8", "(7+9)*2-8", "(8/2)*8-8", "(8-2)+9+9",
  "(3*3)*3-3", "(3+4)*3+3", "(3*3)+3*5", "(3+3)+3*6", "(3-3)+3*8", "(3*4)+3*4", "(4+5)*3-3", "(3-3)+4*6",
  "(4-3)*3*8", "(3*4)+3+9", "(5*5)-3/3", "(3+3)*5-6", "(3+5)/3*9", "(3+7)*3-6", "(3+6)/3*8", "(3*3)+6+9",
  "(3*3)+7+8", "(3*7)+9/3", "(3+8)*3-9", "(3+3)+9+9", "(3+4)*4-4", "(3+5)+4*4", "(4-3)*4*6", "(3*4)+4+8",
  "(4+4)/3*9", "(3-4)+5*5", "(3*4)+5+7", "(3+5)*4-8", "(3*4)+6+6", "(4+8)/3*6", "(3-7)+4*7", "(7-3)*4+8",
  "(3*9)+4-7", "(3+4)+8+9", "(4*9)-3-9", "(5+5)*3-6", "(3*5)/5*8", "(5+7)/3*6", "(6-5)*3*8", "(3-9)+5*6",
  "(3*7)-5+8", "(3+5)+7+9", "(3+5)+8+8", "(3*9)+5-8", "(5/3)*9+9", "(6-3)*6+6", "(6*7)-3*6", "(3*6)/6*8",
  "(3+6)+6+9", "(3+6)+7+8", "(3*7)-6+9", "(6/3)*8+8", "(3*9)+6-9", "(3+7)+7+7", "(3*7)/7*8", "(7-3)*8-8",
  "(3*8)+8-8", "(9-8)*3*8", "(3*8)+9-9", "(9-3)+9+9", "(4+4)+4*4", "(4-4)+4*6", "(4+4)*4-8", "(9-4)*4+4",
  "(5*5)-4/4", "(5-4)*4*6", "(4*5)-4+8", "(4*4)/6*9", "(4*7)+4-8", "(4+4)+7+9", "(4+4)+8+8", "(4*9)-4-8",
  "(4-5)+5*5", "(4*5)/5*6", "(4*5)-5+9", "(6-5)*4*6", "(4+5)+6+9", "(5*7)-4-7", "(4+5)+7+8", "(4*7)+5-9",
  "(9-5)*4+8", "(4*6)+6-6", "(7-4)*6+6", "(4+6)+6+8", "(4*9)-6-6", "(4+6)+7+7", "(8-7)*4*6", "(7+9)/4*6",
  "(4*6)+8-8", "(8/4)*9+6", "(4*6)+9-9", "(7*8)-4*8", "(8-4)*8-8", "(5*5)-5/5", "(5*5)+5-6", "(5+5)+5+9",
  "(5*5)-6/6", "(5*5)+6-7", "(5+5)+6+8", "(5+5)+7+7", "(5*5)+7-8", "(5*5)-8/8", "(5*5)+8-9", "(5*5)-9/9",
  "(5+6)+6+7", "(8-5)*6+6", "(6*9)-5*6", "(7-5)*9+6", "(6+9)/5*8", "(9-6)*5+9", "(7-5)*8+8", "(5*8)-7-9",
  "(5*8)-8-8", "(9-5)*8-8", "(6+6)+6+6", "(6*6)*6/9", "(8-6)*9+6", "(6*7)-9-9", "(8-6)*8+8", "(8+8)/6*9",
  "(9+9)/6*8", "(9-7)*8+8"};

void setup() {
  LCD.begin(16,2); 
  Serial.begin(9600);
  Serial.println(random(306));
  random_pos = random(306);
    //I added the serial print below to help with the post
  Serial.println(random_pos); 
  Serial.println((__FlashStringHelper*)cards[random_pos]); //print a random string from the cards array
  Serial.println((__FlashStringHelper*)solutions[random_pos]); //print a random string from solutions array
  card_to_display = ((__FlashStringHelper*)cards[random_pos]);
  Serial.println(card_to_display); 
}
 
void loop() {
    random_pos = random(306);
	LCD.print("Your card is:");
    LCD.setCursor(0, 1);
  	LCD.print(card_to_display);
  	delay(5000);
  	LCD.clear();
}

Put the line with randomSeed() in setup.

@dylan_k

Hi,

Here's another solution to do away with storing the 'cards'...


const char solutions[306][10] PROGMEM = {
  "(1+1)*2*6", "(1+2)*1*8", "(1+1)*3*4", "(1+3)*1*6", "(1+7)*1*3", "(1-1)+3*8", "(9-1)*1*3", "(1+4)*5-1",
  "(1-1)+4*6", "(7-1)*1*4", "(4-1)*1*8", "(1*5)*5-1", "(5-1)*1*6", "(1+1)*9+6", "(1+1)*8+8", "(1+2)*2*4",
  "(1+5)*2*2", "(1*2)*2*6", "(7-1)*2*2", "(1+3)*2*3", "(1*2)*3*4", "(2+3)*5-1", "(2+6)*1*3", "(1+2)+3*7",
  "(2-1)*3*8", "(1+2)*9-3", "(2+4)*1*4", "(2-1)*4*6", "(4+8)*1*2", "(1+9)*2+4", "(1-2)+5*5", "(5+7)*1*2",
  "(1+5)/2*8", "(1+2)*5+9", "(1+2)*6+6", "(1+7)/2*6", "(1/2)*6*8", "(1*2)*9+6", "(1+7)+2*8", "(1+9)+2*7",
  "(1*2)*8+8", "(2*8)-1+9", "(3-1)*3*4", "(3+5)*1*3", "(1+6)*3+3", "(1*3)+3*7", "(1+8)*3-3", "(1*3)*9-3",
  "(4+4)*1*3", "(1+3)+4*5", "(1+3)*7-4", "(1+3)*4+8", "(1+4)*3+9", "(1+5)+3*6", "(1+8)+3*5", "(1*3)*5+9",
  "(1*3)*6+6", "(3*6)-1+7", "(6-3)*1*8", "(1+9)*3-6", "(1+7)/3*9", "(1+3)*8-8", "(1/3)*8*9", "(9-1)/3*9",
  "(1+4)*4+4", "(1*4)+4*5", "(1+6)*4-4", "(1*4)*7-4", "(1*4)*4+8", "(4*4)-1+9", "(4*5)-1+5", "(1-5)+4*7",
  "(5-1)*4+8", "(4-1)*5+9", "(1+4)*6-6", "(8-4)*1*6", "(1+7)*4-8", "(1*4)*8-8", "(1-9)+4*8", "(1+5)*5-6",
  "(1*5)*6-6", "(1-7)+5*6", "(9-5)*1*6", "(5-1)*8-8", "(1+5)+9+9", "(6-1)*6-6", "(1+6)+8+9", "(1*6)+9+9",
  "(1+7)+7+9", "(1+7)+8+8", "(1*7)+8+9", "(7-1)+9+9", "(1*8)+8+8", "(8-1)+8+9", "(2+2)*2*3", "(2+4)*2*2",
  "(8-2)*2*2", "(2+9)*2+2", "(3+3)*2*2", "(6-2)*2*3", "(2-2)+3*8", "(2*3)+2*9", "(2+2)+4*5", "(2-2)+4*6",
  "(2+2)*7-4", "(2+2)*4+8", "(2+4)+2*9", "(5*5)-2/2", "(5+6)*2+2", "(2*5)+2*7", "(5+8)*2-2", "(2+6)/2*6",
  "(2+7)*2+6", "(2+6)+2*8", "(2*7)+2+8", "(2+2)*8-8", "(2*9)-2+8", "(2+5)*3+3", "(2*3)+3*6", "(2+7)*3-3",
  "(3-2)*3*8", "(2+3)*3+9", "(2+3)*4+4", "(2+4)+3*6", "(3+7)*2+4", "(8-4)*2*3", "(2/3)*4*9", "(2-3)+5*5",
  "(2*3)*5-6", "(2+7)+3*5", "(2*8)+3+5", "(2-5)+3*9", "(2+3)*6-6", "(3*7)+6/2", "(2+8)*3-6", "(2+6)/3*9",
  "(2*7)+3+7", "(2+7)/3*8", "(7-2)*3+9", "(8+8)/2*3", "(9-3)/2*8", "(2*3)+9+9", "(2*4)+4*4", "(2+5)*4-4",
  "(2+6)+4*4", "(7-2)*4+4", "(2*4)*4-8", "(9-2)*4-4", "(5+5)*2+4", "(2+4)*5-6", "(5+7)/2*4", "(4*5)+8/2",
  "(5+9)*2-4", "(6-4)*2*6", "(2-6)+4*7", "(2/4)*6*8", "(4-2)*9+6", "(7+7)*2-4", "(4*7)-8/2", "(2*4)+7+9",
  "(2*4)+8+8", "(2+4)+9+9", "(2*7)+5+5", "(2*5)+5+9", "(5-2)*6+6", "(2*6)+5+7", "(2*5)+6+8", "(5/2)*6+9",
  "(2*5)+7+7", "(5*7)-2-9", "(5*8)-2*8", "(2+5)+8+9", "(2*6)+6+6", "(7-2)*6-6", "(8-6)*2*6", "(6+9)*2-6",
  "(7+8)*2-6", "(2+6)+7+9", "(2+6)+8+8", "(2/6)*8*9", "(2+7)+7+8", "(7+9)*2-8", "(8/2)*8-8", "(8-2)+9+9",
  "(3*3)*3-3", "(3+4)*3+3", "(3*3)+3*5", "(3+3)+3*6", "(3-3)+3*8", "(3*4)+3*4", "(4+5)*3-3", "(3-3)+4*6",
  "(4-3)*3*8", "(3*4)+3+9", "(5*5)-3/3", "(3+3)*5-6", "(3+5)/3*9", "(3+7)*3-6", "(3+6)/3*8", "(3*3)+6+9",
  "(3*3)+7+8", "(3*7)+9/3", "(3+8)*3-9", "(3+3)+9+9", "(3+4)*4-4", "(3+5)+4*4", "(4-3)*4*6", "(3*4)+4+8",
  "(4+4)/3*9", "(3-4)+5*5", "(3*4)+5+7", "(3+5)*4-8", "(3*4)+6+6", "(4+8)/3*6", "(3-7)+4*7", "(7-3)*4+8",
  "(3*9)+4-7", "(3+4)+8+9", "(4*9)-3-9", "(5+5)*3-6", "(3*5)/5*8", "(5+7)/3*6", "(6-5)*3*8", "(3-9)+5*6",
  "(3*7)-5+8", "(3+5)+7+9", "(3+5)+8+8", "(3*9)+5-8", "(5/3)*9+9", "(6-3)*6+6", "(6*7)-3*6", "(3*6)/6*8",
  "(3+6)+6+9", "(3+6)+7+8", "(3*7)-6+9", "(6/3)*8+8", "(3*9)+6-9", "(3+7)+7+7", "(3*7)/7*8", "(7-3)*8-8",
  "(3*8)+8-8", "(9-8)*3*8", "(3*8)+9-9", "(9-3)+9+9", "(4+4)+4*4", "(4-4)+4*6", "(4+4)*4-8", "(9-4)*4+4",
  "(5*5)-4/4", "(5-4)*4*6", "(4*5)-4+8", "(4*4)/6*9", "(4*7)+4-8", "(4+4)+7+9", "(4+4)+8+8", "(4*9)-4-8",
  "(4-5)+5*5", "(4*5)/5*6", "(4*5)-5+9", "(6-5)*4*6", "(4+5)+6+9", "(5*7)-4-7", "(4+5)+7+8", "(4*7)+5-9",
  "(9-5)*4+8", "(4*6)+6-6", "(7-4)*6+6", "(4+6)+6+8", "(4*9)-6-6", "(4+6)+7+7", "(8-7)*4*6", "(7+9)/4*6",
  "(4*6)+8-8", "(8/4)*9+6", "(4*6)+9-9", "(7*8)-4*8", "(8-4)*8-8", "(5*5)-5/5", "(5*5)+5-6", "(5+5)+5+9",
  "(5*5)-6/6", "(5*5)+6-7", "(5+5)+6+8", "(5+5)+7+7", "(5*5)+7-8", "(5*5)-8/8", "(5*5)+8-9", "(5*5)-9/9",
  "(5+6)+6+7", "(8-5)*6+6", "(6*9)-5*6", "(7-5)*9+6", "(6+9)/5*8", "(9-6)*5+9", "(7-5)*8+8", "(5*8)-7-9",
  "(5*8)-8-8", "(9-5)*8-8", "(6+6)+6+6", "(6*6)*6/9", "(8-6)*9+6", "(6*7)-9-9", "(8-6)*8+8", "(8+8)/6*9",
  "(9+9)/6*8", "(9-7)*8+8"
};

void extractCards() {
  char * num;
  char temp[12];
  for (uint16_t i = 0; i < 306; i ++) {
    memcpy_P(temp, solutions[i], 10);
    Serial.println(temp);
    num = strtok (temp, "()*/+-");
    while (num != NULL)
    {
      Serial.print(num);
      num = strtok (NULL, "()*/+-");
      if (num != NULL)Serial.print(",");
    }
    Serial.println();
  }
}

void setup() {
  
  Serial.begin(115200);
  delay(2000);
  extractCards();
}

void loop() {}

Outputs..

(1+1)*2*6
1,1,2,6
(1+2)*1*8
1,2,1,8
(1+1)*3*4
1,1,3,4
(1+3)*1*6
1,3,1,6
(1+7)*1*3
1,7,1,3
(1-1)+3*8
1,1,3,8
(9-1)*1*3
9,1,1,3......

So this was working originally, but I just realized that my original format where it is always 10 characters per entry isn't going to work when checking if the user entered a correct sequence. That is because some cards can be solved in completely different ways. For example: the card '5,5,7,7' could be solved as '5+5+7+7' or as '5*5 - 7/7'. My plan for checking if the user entered a valid card is to just have the solutions entry for a given card (say '5,5,7,7') contain every possible solution, even if they are functionally the same (like '5+5+7+7' and '7+5+5+7'). I updated my card finder slightly and it now outputs every possible valid solve for every valid card. The problem is, I manually entered an example and got the error: "107:27: error: initializer-string for array of chars is too long [-fpermissive]" when I used:
"

const char solutions[306] [10] PROGMEM = { 

I then tried removing the part that says how long each entry is (which will need to be removed anyway, since some cards have more solutions that others) and got the error: "107:27: error: too many initializers for 'const char [306]'" when I used:

const char solutions[306] PROGMEM = {

My list entries currently have the format (where '?' is some operator): '(#1?#2)?#3?4$(#1?#2)?#3?4$' etc.
Basically I have the same format as last time, but I added extra parentheses to make evaluation more reliable and easy to code. I also added the ability to store multiple solutions by separating them with a junk character (I decided to use '$').

Here is an actual solutions entry that I plan on using for the card '1,1,2,6':
"$(1+1)26$((1+1)62$(1+1)26$(1+1)62" (It looks like each card is entered twice, that is because the code decided that switching the 1s was a valid way of making a 'new' card.)

My other idea (and the one that I think has a better chance of working) is to get rid of the solutions array entirely. To check if the user entered a valid sequence I could evaluate their sequence and check if it equals 24. I am really struggling to find things online, and I am used to using JavaScript (since I have been using that for years) and so I got spoiled with the 'eval()' function. Any help figuring out the best way to evaluate a string entered by a user would be much appreciated. The string will take the format of 4 single digit numbers separated by operators (I am only letting the user use: + - * /). For example: '4/4*6+7'

Btw, sorry this message is so long...

EDIT: I changed the solutions string format since my JavaScript code that creates cards doesn't work properly when the parentheses are added. This is because it can output things like '(5 * 5)-7/7' which is true, but if forcefully add parentheses is becomes '((5 * 5)-7)/7' which is not true.

I just checked to see how much memory the new list of solutions would take up, and it is way to much. The calculator I used said it was 63.3 KB, and the Arduino uno's PROGMEM is 32KB. I think the best bet is to try and evaluate the string the user entered to see if it equals 24, since that can actually fit on the Arduino.