├── .gitignore ├── .vscode └── settings.json ├── 51nod ├── 1000.scl ├── 1001.cc ├── 1002.py ├── 1003.py ├── 1004.py ├── 1005.go ├── 1006.cc ├── 1007.py ├── 1008.py ├── 1009.py ├── 1010.cc ├── 1011.py ├── 1012.py ├── 1013.py ├── 1014.py ├── 1015.py ├── 1018.cc ├── 1019.go ├── 1020.cc ├── 1021.cc ├── 1024.py ├── 1027.go ├── 1028.py ├── 1029.py ├── 1030.py ├── 1031.py ├── 1035.py ├── 1040.cc ├── 1042.py ├── 1043.cc ├── 1046.py ├── 1049.py ├── 1050.py ├── 1051.cc ├── 1057.py ├── 1058.py ├── 1059.py ├── 1060.cc ├── 1062.py ├── 1065.cc ├── 1066.py ├── 1067.py ├── 1068.py ├── 1069.py ├── 1070.py ├── 1072.py ├── 1073.py ├── 1076.cc ├── 1080.py ├── 1081.py ├── 1082.py ├── 1083.py ├── 1084.cc ├── 1085.cc ├── 1086.cc ├── 1087.py ├── 1088.cc ├── 1089.cc ├── 1090.py ├── 1091.py ├── 1092.cc ├── 1094.py ├── 1095.py ├── 1096.py ├── 1097.py ├── 1098.py ├── 1099.py ├── 1100.py ├── 1101.cc ├── 1102.py ├── 1103.py ├── 1105.cc ├── 1106.py ├── 1107.cc ├── 1108.py ├── 1110.py ├── 1111.cc ├── 1112.cc ├── 1113.py ├── 1116.py ├── 1117.py ├── 1118.py ├── 1119.cc ├── 1126.py ├── 1127.py ├── 1128.py ├── 1130.py ├── 1133.cc ├── 1134.cc ├── 1136.py ├── 1137.cs ├── 1138.py ├── 1153.cc ├── 1154.cc ├── 1158.cc ├── 1163.cc ├── 1166.py ├── 1174.cc ├── 1175.cc ├── 1179.cc ├── 1181.py ├── 1182.py ├── 1183.cc ├── 1185.py ├── 1186.py ├── 1191.cc ├── 1202.py ├── 1204.cc ├── 1205.cc ├── 1212.cc ├── 1215.cc ├── 1225.cs ├── 1240.cc ├── 1241.cc ├── 1242.py ├── 1243.cc ├── 1247.py ├── 1255.py ├── 1256.cc ├── 1262.py ├── 1264.cc ├── 1265.py ├── 1266.py ├── 1267.py ├── 1268.py ├── 1270.py ├── 1272.cc ├── 1275.cs ├── 1277.cs ├── 1279.cc ├── 1280.cc ├── 1281.cc ├── 1282.cc ├── 1284.py ├── 1285.cc ├── 1287.cc ├── 1288.cc ├── 1289.py ├── 1293.cc ├── 1294.cc ├── 1298.cc ├── 1305.py ├── 1307.cc ├── 1310.cs ├── 1315.py ├── 1319.py ├── 1344.py ├── 1347.py ├── 1350.cc ├── 1351.py ├── 1352.cc ├── 1354.cc ├── 1366.cc ├── 1381.py ├── 1383.cc ├── 1384.py ├── 1385.py ├── 1390.py ├── 1391.cc ├── 1393.py ├── 1394.cc ├── 1396.py ├── 1398.cc ├── 1400.cc ├── 1402.py ├── 1403.cc ├── 1405.cc ├── 1406.cc ├── 1413.py ├── 1414.py ├── 1417.py ├── 1418.py ├── 1419.py ├── 1420.py ├── 1421.cc ├── 1422.cc ├── 1428.cc ├── 1431.py ├── 1432.py ├── 1433.py ├── 1434.cc ├── 1435.py ├── 1436.py ├── 1437.cc ├── 1441.cc ├── 1444.cc ├── 1449.py ├── 1451.py ├── 1452.py ├── 1453.cc ├── 1455.cc ├── 1458.cc ├── 1459.cc ├── 1460.cc ├── 1461.cc ├── 1464.cc ├── 1467.cc ├── 1473.cc ├── 1475.cc ├── 1476.py ├── 1478.py ├── 1483.py ├── 1484.py ├── 1487.py ├── 1489.cc ├── 1490.cc ├── 1491.py ├── 1495.cc ├── 1515.cc ├── 1521.cc ├── 1533.cc ├── 1534.py ├── 1536.py ├── 1548.py ├── 1549.cc ├── 1556.go ├── 1557.py ├── 1559.cc ├── 1562.cc ├── 1566.cc ├── 1572.cc ├── 1596.cc ├── 1605.py ├── 1613.py ├── 1621.py ├── 1624.cc ├── 1625.cc ├── 1627.py ├── 1629.py ├── 1631.cc ├── 1632.cc ├── 1636.cc ├── 1637.cc ├── 1639.py ├── 1640.cc ├── 1649.cc ├── 1670.py ├── 1672.cc ├── 1674.cc ├── 1677.cc ├── 1682.cc ├── 1686.cc ├── 1705.cc ├── 1714.py ├── 1717.py ├── 1718.py ├── 1732.py ├── 1737.cc ├── 1770.py ├── 1779.cc ├── 1785.cc ├── 1786.cc ├── 1791.py ├── 1799.cc ├── 1821.cc ├── 1832.py ├── 1873.py ├── 1875.py ├── 2006.cc ├── 2020.py ├── 2133.py ├── 2387.py ├── 2485.py ├── 2673.py └── 3425.cc ├── AcWing ├── 282.cc ├── 389.cc ├── 89.py ├── 90.py └── 998.cc ├── AtCoder ├── AtCoder Beginner Contest 051 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.cc ├── AtCoder Beginner Contest 151 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 153 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 159 │ ├── D.cc │ └── F.cc ├── AtCoder Beginner Contest 160 │ ├── D.py │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 161 │ ├── D.py │ ├── E.py │ └── F.py ├── AtCoder Beginner Contest 165 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 168 │ ├── D.py │ └── E.py ├── AtCoder Beginner Contest 185 │ ├── A.fs │ ├── B.fs │ ├── C.fs │ ├── D.fs │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 187 │ ├── A.fs │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 188 │ ├── A.fs │ ├── B.fs │ ├── C.fs │ ├── D.py │ ├── E.py │ └── F.py ├── AtCoder Beginner Contest 190 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 191 │ ├── D.py │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 192 │ ├── D.py │ └── E.cc ├── AtCoder Beginner Contest 197 │ ├── D.cc │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 198 │ ├── D.cc │ └── E.py ├── AtCoder Beginner Contest 199 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 200 │ ├── C.py │ ├── D.py │ └── E.py ├── AtCoder Beginner Contest 201 │ ├── C.py │ └── D.cc ├── AtCoder Beginner Contest 202 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.py ├── AtCoder Beginner Contest 210 │ └── C.py ├── AtCoder Beginner Contest 218 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 221 │ └── F.cc ├── AtCoder Beginner Contest 225 │ ├── A.py │ ├── B.py │ └── C.py ├── AtCoder Beginner Contest 229 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.cc │ ├── F.py │ └── G.cc ├── AtCoder Beginner Contest 231 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 233 │ ├── A.fs │ ├── B.fs │ └── C.py ├── AtCoder Beginner Contest 247 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 248 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.py │ └── F.cc ├── AtCoder Beginner Contest 249 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── F.cc ├── AtCoder Beginner Contest 253 │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.py │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 261 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 282 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.py ├── AtCoder Beginner Contest 283 │ ├── C.py │ ├── D.py │ └── F.cc ├── AtCoder Beginner Contest 286 │ ├── D.py │ └── E.cc ├── AtCoder Beginner Contest 297 │ ├── D.py │ └── E.cc ├── AtCoder Beginner Contest 304 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── AtCoder Beginner Contest 306 │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 319 │ ├── C.cc │ ├── D.py │ └── E.py ├── AtCoder Beginner Contest 323 │ ├── D.cc │ ├── E.cc │ └── F.cc ├── AtCoder Beginner Contest 343 │ └── D.cc ├── AtCoder Beginner Contest 344 │ ├── C.py │ ├── D.cc │ └── E.cc ├── AtCoder Beginner Contest 356 │ ├── D.py │ ├── E.py │ ├── F.cc │ └── G.cc ├── AtCoder Beginner Contest 368 │ ├── C.py │ └── D.cc ├── AtCoder Regular Contest 111 │ ├── A.py │ ├── B.cc │ ├── C.cc │ ├── D.cc │ └── E.cc ├── AtCoder Regular Contest 116 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── AtCoder Regular Contest 118 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── Hitachi Programming Contest 2020 │ ├── A.py │ ├── B.py │ └── D.py ├── KEYENCE Programming Contest 2021 │ ├── A.py │ ├── B.py │ └── C.cc ├── M-SOLUTIONS Programming Contest 2020 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.cc ├── Panasonic Programming Contest 2020 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ └── E.cc └── UNICORN Programming Contest 2022 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.py │ └── F.py ├── BJTU OJ ├── 1623.cc └── 1630.cc ├── BNU OJ └── 2708.cc ├── BUPT OJ ├── kAri │ ├── 201.cc │ ├── 204.cc │ ├── 207.cc │ ├── 209.cc │ └── 210.cc ├── n.boj │ ├── 1459.cc │ ├── 168.cc │ ├── 23.cc │ ├── 24.cc │ ├── 260.cc │ ├── 261.cc │ ├── 262.cc │ ├── 263.cc │ ├── 264.cc │ ├── 265.cc │ ├── 266.cc │ ├── 267.cc │ ├── 268.cc │ ├── 297.cc │ ├── 32.cc │ ├── 354.cc │ ├── 519.cc │ ├── 593.cc │ ├── 8.cc │ ├── 84.cc │ ├── 9.cc │ └── n.boj Tencent Monthly.12 │ │ ├── A.cc │ │ ├── B.cc │ │ ├── C.cc │ │ ├── D.cc │ │ ├── E.cc │ │ └── F.cc └── o.boj │ ├── 1000.cpp │ ├── 1001.cpp │ ├── 1002.cc │ ├── 1003.cpp │ ├── 1004.cpp │ ├── 1005.cc │ ├── 1012.cc │ ├── 1015.cpp │ ├── 1016.cc │ ├── 1017.cpp │ ├── 1020.cc │ ├── 1023.cpp │ ├── 1028.cpp │ ├── 1029.cc │ ├── 1031.cpp │ ├── 1032.cc │ ├── 1033.cpp │ ├── 1034.cc │ ├── 1035.cc │ ├── 1036.cc │ ├── 1037.cc │ ├── 1039.cpp │ ├── 1040.cc │ ├── 1041.cc │ ├── 1042.cc │ ├── 1043.cpp │ ├── 1044.cc │ ├── 1045.cc │ ├── 1046.cpp │ ├── 1047.cpp │ ├── 1048.cpp │ ├── 1051.cpp │ ├── 1053.cpp │ ├── 1054.cpp │ ├── 1055.cc │ ├── 1059.cpp │ ├── 1060.cpp │ ├── 1064.cpp │ ├── 1065.cc │ ├── 1066.cc │ ├── 1067.cpp │ ├── 1068.cc │ ├── 1069.cc │ ├── 1071.cpp │ ├── 1073.cpp │ ├── 1076.cpp │ ├── 1078.cc │ ├── 1079.cc │ ├── 1080.cpp │ ├── 1081.cpp │ ├── 1083.cc │ ├── 1084.cc │ ├── 1085.cc │ ├── 1087.cc │ ├── 1088.cc │ ├── 1089.cc │ ├── 1090.cpp │ ├── 1091.cc │ ├── 1092.cc │ ├── 1093.cpp │ ├── 1094.cc │ ├── 1095.cc │ ├── 1096.cpp │ ├── 1098.cc │ ├── 1099.cpp │ ├── 1102.cc │ ├── 1103.cpp │ ├── 1108.cc │ ├── 1112.cc │ ├── 1118.cpp │ ├── 1120.cpp │ ├── 1128.cc │ ├── 1131.cc │ ├── 1134.cc │ ├── 1146.cc │ ├── 1147.cc │ ├── 1155.cc │ ├── 1166.cc │ ├── 1170.cc │ ├── 1171.cpp │ ├── 1177.cc │ ├── 1180.cc │ ├── 1184.cc │ ├── 1185.cc │ ├── 1186.cpp │ ├── 1187.cpp │ ├── 1189.cpp │ ├── 1193.cc │ ├── 1195.cc │ ├── 1196.cpp │ ├── 1202.cc │ ├── 1205.cc │ ├── 1209.cpp │ ├── 1212.cpp │ ├── 1214.cpp │ ├── 1219.cc │ ├── 1221.cc │ ├── 1222.cc │ ├── 1224.cpp │ ├── 1225.cc │ ├── 1226.cpp │ ├── 1228.cpp │ ├── 1229.cpp │ ├── 1230.cpp │ ├── 1231.cc │ ├── 1232.cpp │ ├── 1233.cc │ ├── 1233.cpp │ ├── 1234.cpp │ ├── 1235.cpp │ ├── 1236.cpp │ ├── 1237.cc │ ├── 1238.cpp │ ├── 1240.cc │ ├── 1242.cc │ ├── 1250.cc │ ├── 1251.cc │ ├── 1252.cpp │ ├── 1253.cc │ ├── 1254.cpp │ ├── 1256.cpp │ ├── 1257.cc │ ├── 1260.cpp │ ├── 1261.cpp │ ├── 1264.cc │ ├── 1265.cpp │ ├── 1266.cpp │ ├── 1267.cpp │ ├── 1268.cpp │ ├── 1269.cc │ ├── 1270.cc │ ├── 1271.cc │ ├── 1272.cpp │ ├── 1273.cc │ ├── 1274.cc │ ├── 1276.cc │ ├── 1277.cpp │ ├── 1280.cpp │ ├── 1283.cc │ ├── 1286.cc │ ├── 1289.cc │ ├── 1290.cpp │ ├── 1292.cpp │ ├── 1293.cc │ ├── 1294.cc │ ├── 1295.cc │ ├── 1296.cc │ ├── 1297.cc │ ├── 1298.cc │ ├── 1299.cpp │ ├── 1301.cc │ ├── 1302.cc │ ├── 1303.cpp │ ├── 1305.cpp │ ├── 1306.cpp │ ├── 1307.cpp │ ├── 1315.cpp │ ├── 1317.cc │ ├── 1319.cpp │ ├── 1320.cc │ ├── 1321.cc │ ├── 1322.cc │ ├── 1323.cpp │ ├── 1324.cpp │ ├── 1325.cpp │ ├── 1326.cc │ ├── 1328.cpp │ ├── 1329.cpp │ ├── 1330.cc │ ├── 1331.cc │ ├── 1333.cc │ ├── 1334.cc │ ├── 1335.cc │ ├── 1336.cc │ ├── 1339.cpp │ ├── 1342.cc │ ├── 1345.cc │ ├── 1356.cc │ ├── 1362.cc │ ├── 1364.cc │ ├── 1367.cc │ ├── 1368.cpp │ ├── 1377.cc │ ├── 1378.cc │ ├── 1379.cc │ ├── 1394.cc │ ├── 1407.cc │ ├── 1412.cc │ ├── 1415.cc │ ├── 1416.cpp │ ├── 1417.cpp │ ├── 1418.cpp │ ├── 1419.cpp │ ├── 1421.cpp │ ├── 1422.cc │ ├── 1424.cc │ ├── 1425.cpp │ ├── 1426.cpp │ ├── 1427.cpp │ ├── 1428.cc │ ├── 1429.cc │ ├── 1434.cc │ ├── 1435.cpp │ ├── 1436.cpp │ ├── 1437.cc │ ├── 1438.cc │ ├── 1439.cpp │ ├── 1440.cc │ ├── 1441.cc │ ├── 1444.cpp │ ├── 1445.cc │ ├── 1449.cc │ ├── 1450.cc │ ├── 1451.cpp │ ├── 1452.cc │ ├── 1454.cc │ ├── 1456.cc │ ├── 1457.cpp │ ├── 1461.cc │ ├── 1463.cc │ ├── 1472.cpp │ ├── 1473.cpp │ ├── 1474.cc │ ├── 1475.cc │ ├── 1477.cpp │ ├── 1478.cpp │ ├── 1479.cc │ ├── 1481.cc │ ├── 1483.cc │ ├── 1484.cpp │ ├── 1485.cc │ ├── 1488.cc │ ├── 1490.cpp │ ├── 1493.cc │ ├── 1497.cpp │ ├── 1498.cc │ ├── 1499.cc │ ├── 1501.cpp │ ├── 1503.cpp │ ├── 1505.cc │ ├── 1506.cc │ ├── 1509.cc │ ├── 1510.cc │ ├── 1512.cpp │ ├── 1513.cpp │ ├── 1522.cpp │ ├── 1523.cpp │ ├── 1524.cpp │ ├── 1542.cpp │ ├── 1543.cc │ ├── 1544.cpp │ ├── 1548.cpp │ ├── 1549.cc │ ├── 1550.cc │ ├── 1552.cc │ ├── 1553.cpp │ ├── 1554.cpp │ ├── 1555.cpp │ ├── 1556.cpp │ ├── 1557.cpp │ ├── 1558.cpp │ ├── 1559.cpp │ ├── 1560.cc │ ├── 1561.cpp │ ├── 1562.cpp │ ├── 1563.cpp │ ├── 1566.cc │ ├── 1570.cpp │ ├── 1574.cc │ ├── 1582.cc │ ├── 1589.cc │ ├── 1593.cc │ ├── 1619.cpp │ ├── 1620.cpp │ ├── 1673.cc │ ├── 1696.cpp │ ├── 1700.cc │ ├── 1728.cc │ ├── 1739.cc │ ├── 1743.cpp │ ├── 1746.cc │ ├── 1747.cpp │ ├── 1749.cc │ ├── 1754.cc │ ├── 1764.cc │ ├── 1765.cc │ ├── 1768.cc │ ├── 1769.cc │ ├── 1771.cc │ ├── 1772.cc │ ├── 1773.cc │ ├── 1782.cpp │ ├── 1786.cc │ ├── 1789.cc │ ├── 1793.cc │ ├── 1799.cc │ ├── 1803.cpp │ ├── 1807.java │ ├── 1814.cc │ ├── 1815.cc │ ├── 1822.cpp │ ├── 1823.cpp │ ├── 1824.cpp │ ├── 1825.cpp │ ├── 1826.cpp │ ├── 1827.cpp │ ├── 1829.cpp │ ├── 1830.cc │ ├── 1832.cpp │ ├── 1833.cpp │ ├── 1834.cpp │ ├── 1835.cpp │ ├── 1837.cpp │ ├── 1838.cpp │ ├── 1839.cpp │ ├── 1841.cpp │ ├── 1842.cc │ ├── 1869.cc │ ├── 1876.cpp │ ├── 1877.cpp │ ├── 1878.cpp │ ├── 1879.cpp │ ├── 1880.cc │ ├── 1880.cpp │ ├── 1890.cc │ ├── 1894.cc │ ├── 1897.cc │ ├── 1899.cpp │ ├── 1900.cc │ ├── 1902.cc │ ├── 1903.cc │ ├── 1904.cc │ ├── 1905.cc │ ├── 1906.cc │ ├── 1907.cc │ ├── 1910.cc │ ├── 1911.cc │ ├── 1922.cc │ └── 1923.cc ├── Codechef ├── BMI.py ├── CHSTR.cc └── MINMAX3.py ├── Codeeval ├── Easy │ └── Football.py ├── Hard │ ├── Brainf_ck.cc │ ├── Grinch.py │ ├── Prefix Expressions.py │ ├── String Permutations.cc │ └── The Tourist.py └── Moderate │ ├── Longest Lines.py │ ├── To PI Or Not To PI.py │ └── Try To Solve It.py ├── Codeforces ├── 128B.cc ├── 15-295 Spring 2022 │ └── #1 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.py │ │ ├── D.cc │ │ ├── E.cc │ │ ├── F.cc │ │ └── G.py ├── 2023-2024 ICPC, NERC, Northern Eurasia Onsite │ └── K.py ├── 208A.py ├── 22D.cc ├── 27E.cc ├── 3C.cc ├── 402E.cc ├── 435D.cc ├── 55D.cc ├── 65A.cc ├── ABBYY Cup 2.0 - Easy │ └── 177D1.cc ├── AIM Tech Round 3 (Div. 1) │ └── C.cc ├── Bubble Cup 13 - Finals [Online Mirror, unrated, Div. 1] │ └── B.cc ├── CodeForces - 23B │ └── B.py ├── Codeforces Beta Round #55 (Div. 2) │ └── 59A.py ├── Codeforces Beta Round #63 (Div. 2) │ └── A.py ├── Codeforces Beta Round #65 (Div. 2) │ ├── A.py │ └── C.py ├── Codeforces Beta Round #82 (Div. 2) │ ├── A.cc │ ├── B.cc │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Codeforces Beta Round #86 (Div. 2) │ ├── a.py │ ├── b.py │ ├── c.py │ ├── d.cc │ └── e.cc ├── Codeforces Beta Round #87 (Div. 2 Only) │ ├── A.java │ ├── B.cc │ └── C.cc ├── Codeforces Beta Round #93 (Div. 2 Only) │ ├── D.cc │ └── D.py ├── Codeforces Beta Round #97 (Div. 2) │ ├── A.cc │ ├── B.py │ ├── C.py │ ├── D.cc │ └── e.py ├── Codeforces Global Round 8 │ └── A.cc ├── Codeforces Global Round 9 │ └── D.py ├── Codeforces Raif Round 1 (Div. 1 + Div. 2) │ └── C.cc ├── Codeforces Round #102 (Div. 2) │ ├── A.py │ ├── B.cc │ ├── C.py │ ├── D.cc │ └── E.cc ├── Codeforces Round #104 (Div. 2) │ ├── A.cc │ ├── B.cc │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Codeforces Round #106 (Div. 2) │ └── D.py ├── Codeforces Round #113 (Div. 2) │ └── E.cc ├── Codeforces Round #116 (Div. 2) │ ├── E.py │ ├── a.cc │ ├── b.py │ ├── c.cc │ ├── d.cc │ └── f.cc ├── Codeforces Round #119 (Div. 2) │ └── A.py ├── Codeforces Round #121 (Div. 2) │ └── E.cc ├── Codeforces Round #134 (Div. 2) │ └── C.py ├── Codeforces Round #142 (Div. 2) │ └── B.cc ├── Codeforces Round #146 (Div. 2) │ ├── A.cc │ └── C.py ├── Codeforces Round #148 (Div. 2) │ ├── A.py │ └── A.scala ├── Codeforces Round #149 (Div. 2) │ ├── A.scl │ ├── D.cc │ └── c.py ├── Codeforces Round #150 (Div. 2) │ └── C.cc ├── Codeforces Round #151 (Div. 2) │ └── D.cc ├── Codeforces Round #157 (Div. 2) │ └── C.py ├── Codeforces Round #158 (Div. 2) │ ├── a.cc │ ├── b.py │ ├── c.py │ ├── d.py │ └── e.cc ├── Codeforces Round #162 (Div. 2) │ └── D.cc ├── Codeforces Round #163 (Div. 2) │ └── B.py ├── Codeforces Round #164 (Div. 2) │ ├── A.py │ ├── A.scl │ ├── B.hs │ ├── B.py │ ├── B.scl │ └── C.py ├── Codeforces Round #165 (Div. 2) │ ├── a.py │ ├── b.py │ ├── c.py │ ├── d.py │ └── e.cc ├── Codeforces Round #166 (Div. 2) │ ├── A.scl │ └── B.scl ├── Codeforces Round #168 (Div. 2) │ └── D.cc ├── Codeforces Round #169 (Div. 2) │ └── D.py ├── Codeforces Round #171 (Div. 2) │ └── C.cc ├── Codeforces Round #172 (Div. 2) │ └── D.cc ├── Codeforces Round #174 (Div. 2) │ ├── C.cc │ └── D.cc ├── Codeforces Round #175 (Div. 2) │ ├── A.py │ ├── B.cc │ └── C.scala ├── Codeforces Round #179 (Div. 1) │ ├── 295A.cc │ └── B.cc ├── Codeforces Round #181 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.cc ├── Codeforces Round #182 (Div. 1) │ └── A.py ├── Codeforces Round #184 (Div. 2) │ ├── A.py │ ├── B.scala │ ├── C.cc │ └── input.txt~ ├── Codeforces Round #185 (Div. 2) │ └── B.py ├── Codeforces Round #188 (Div. 2) │ ├── A.scala │ ├── B.scala │ ├── C.scala │ ├── D.cc │ ├── E.cc │ └── libpeerconnection.log ├── Codeforces Round #190 (Div. 2) │ └── D.cc ├── Codeforces Round #194 (Div. 2) │ └── 334A.py ├── Codeforces Round #196 (Div. 2) │ └── c.py ├── Codeforces Round #197 (Div. 2) │ ├── 339A.py │ └── 339C.py ├── Codeforces Round #199 (Div. 2) │ ├── a.py │ ├── b.cc │ └── c.py ├── Codeforces Round #200 (Div. 2) │ ├── a.py │ ├── b.py │ ├── c.py │ ├── d.py │ └── e.cc ├── Codeforces Round #202 (Div. 2) │ └── B.py ├── Codeforces Round #206 (Div. 2) │ └── C.cc ├── Codeforces Round #208 (Div. 2) │ └── 358D.py ├── Codeforces Round #211 (Div. 2) │ └── D.py ├── Codeforces Round #212 (Div. 2) │ ├── a.cc │ ├── b.py │ ├── c.cc │ ├── d.cc │ └── e.cc ├── Codeforces Round #213 (Div. 2) │ ├── a.py │ ├── b.cc │ ├── c.cc │ ├── d.cc │ └── e.cc ├── Codeforces Round #214 (Div. 2) │ ├── a.py │ └── b.cc ├── Codeforces Round #215 (Div. 2) │ ├── a.py │ ├── b.cc │ ├── c.cc │ ├── d.cc │ └── e.cc ├── Codeforces Round #216 (Div. 2) │ └── 369C.py ├── Codeforces Round #217 (Div. 2) │ ├── a.py │ ├── b.py │ └── c.cc ├── Codeforces Round #218 (Div. 2) │ ├── a.py │ ├── b.py │ ├── c.cc │ ├── d.cc │ └── e.cc ├── Codeforces Round #219 (Div. 1) │ └── 372B.cc ├── Codeforces Round #219 (Div. 2) │ ├── a.py │ ├── b.py │ └── c.cc ├── Codeforces Round #220 (Div. 2) │ ├── C.cc │ ├── D.cc │ ├── a.scala │ └── b.js ├── Codeforces Round #221 (Div. 2) │ ├── a.py │ ├── b.py │ ├── c.cc │ └── d.cc ├── Codeforces Round #223 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Codeforces Round #225 (Div. 2) │ ├── A.py │ └── C.py ├── Codeforces Round #228 (Div. 2) │ └── B.py ├── Codeforces Round #238 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #239 (Div. 2) │ └── D.py ├── Codeforces Round #240 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ └── E.cc ├── Codeforces Round #244 (Div. 2) │ ├── 427A.py │ ├── 427B.py │ ├── 427C.cc │ ├── 427D.cc │ └── 427E.py ├── Codeforces Round #245 (Div. 2) │ └── D.cc ├── Codeforces Round #248 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #250 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #251 │ ├── 439A.py │ ├── 439B.py │ ├── 439C.py │ └── 439D.cc ├── Codeforces Round #253 │ ├── 442A.cc │ ├── 442B.py │ ├── 443A.py │ └── 443B.cc ├── Codeforces Round #254 │ ├── 445A.py │ ├── 445B.cc │ ├── 445C.cc │ ├── 445D.cc │ └── 445E.cc ├── Codeforces Round #256 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #258 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.py ├── Codeforces Round #264 (Div. 2) │ ├── 463C.py │ ├── A.py │ └── B.py ├── Codeforces Round #265 (Div. 2) │ └── C.cc ├── Codeforces Round #266 (Div. 2) │ ├── C.py │ └── D.cc ├── Codeforces Round #267 (Div. 2) │ └── C.cc ├── Codeforces Round #268 (Div. 2) │ └── D.cc ├── Codeforces Round #271 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── F.cc ├── Codeforces Round #272 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.py │ └── E.cc ├── Codeforces Round #273 (Div. 2) │ ├── 478C.py │ └── 478D.cc ├── Codeforces Round #274 (Div. 1) │ ├── A.py │ ├── B.cc │ └── C.cc ├── Codeforces Round #275 (Div. 2) │ └── D.cc ├── Codeforces Round #276 (Div. 2) │ ├── A.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #277.5 (Div. 2) │ └── B.cc ├── Codeforces Round #278 (Div. 2) │ └── D.cc ├── Codeforces Round #279 (Div. 2) │ ├── 490A.py │ ├── 490B.py │ └── 490C.cc ├── Codeforces Round #280 (Div. 2) │ └── A.py ├── Codeforces Round #282 (Div. 2) │ └── C.py ├── Codeforces Round #283 (Div. 2) │ └── A.py ├── Codeforces Round #287 (Div. 2) │ └── E.cc ├── Codeforces Round #288 (Div. 2) │ ├── A.cc │ ├── B.py │ ├── C.py │ ├── D.cc │ └── E.py ├── Codeforces Round #289 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ ├── E.py │ └── F.cc ├── Codeforces Round #290 (Div. 2) │ ├── A.py │ ├── B.cc │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Codeforces Round #291 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ └── E.cc ├── Codeforces Round #294 (Div. 2) │ ├── D.cc │ └── E.cc ├── Codeforces Round #296 (Div. 2) │ ├── C.cc │ └── D.cc ├── Codeforces Round #302 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #304 (Div. 2) │ └── 546D.cc ├── Codeforces Round #308 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.py ├── Codeforces Round #313 (Div. 1) │ └── B.py ├── Codeforces Round #320 (Div. 2) │ └── D.cc ├── Codeforces Round #321 (Div. 2) │ ├── a.py │ ├── b.py │ ├── c.cc │ ├── d.cc │ └── e.cc ├── Codeforces Round #328 (Div. 2) │ ├── a.cc │ ├── b.py │ ├── c.py │ └── d.cc ├── Codeforces Round #330 (Div. 2) │ ├── A.go │ ├── B.go │ └── C.go ├── Codeforces Round #332 (Div. 2) │ └── A.go ├── Codeforces Round #337 (Div. 2) │ ├── A.py │ ├── B.cc │ ├── C.py │ └── D.cc ├── Codeforces Round #340 (Div. 2) │ ├── A.cs │ ├── B.cs │ └── C.cs ├── Codeforces Round #346 (Div. 2) │ └── D.py ├── Codeforces Round #349 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.cc ├── Codeforces Round #356 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.cc ├── Codeforces Round #362 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #364 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.py │ └── E.cc ├── Codeforces Round #371 (Div. 2) │ └── C.cc ├── Codeforces Round #377 (Div. 2) │ ├── A.py │ ├── B.cc │ └── C.py ├── Codeforces Round #378 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Codeforces Round #382 (Div. 2) │ └── D.cc ├── Codeforces Round #383 (Div. 2) │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Codeforces Round #386 (Div. 2) │ └── C.py ├── Codeforces Round #404 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.py ├── Codeforces Round #435 (Div. 2) │ └── B.cc ├── Codeforces Round #474 (Div. 1 + Div. 2, combined) │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.cc ├── Codeforces Round #476 (Div. 2) │ ├── C.py │ ├── D.cc │ └── E.cc ├── Codeforces Round #480 (Div. 2) │ ├── C.cc │ └── D.cc ├── Codeforces Round #482 (Div. 2) │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #483 (Div. 2) │ ├── A.go │ └── B.go ├── Codeforces Round #486 (Div. 3) │ └── C.py ├── Codeforces Round #487 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.py ├── Codeforces Round #488 by NEAR (Div. 2) │ └── A.go ├── Codeforces Round #554 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.py ├── Codeforces Round #555 (Div. 3) │ ├── A.py │ ├── B.py │ ├── C1.py │ ├── C2.py │ ├── D.py │ ├── E.cc │ ├── F.py │ └── G.py ├── Codeforces Round #578 (Div. 2) │ └── E.cc ├── Codeforces Round #604 (Div. 2) │ ├── A.py │ ├── B.cc │ ├── C.cc │ └── D.py ├── Codeforces Round #609 (Div. 2) │ ├── A.py │ ├── B.cc │ ├── C.cc │ └── D.py ├── Codeforces Round #613 (Div. 2) │ ├── A.py │ ├── B.cc │ ├── C.py │ ├── D.cc │ ├── E.cc │ └── F.cc ├── Codeforces Round #614 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Codeforces Round #622 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.py ├── Codeforces Round #633 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.cc │ ├── E.py │ └── README ├── Codeforces Round #637 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.cc │ ├── E.cc │ └── F.cc ├── Codeforces Round #638 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.py ├── Codeforces Round #644 (Div. 3) │ ├── F.py │ └── G.py ├── Codeforces Round #661 (Div. 3) │ └── A.py ├── Codeforces Round #690 (Div. 3) │ └── C.cc ├── Codeforces Round #696 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round #705 (Div. 2) │ └── A.py ├── Codeforces Round #708 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C1.py │ ├── C2.py │ ├── D.py │ └── E1.cc ├── Codeforces Round #712 (Div. 1) │ ├── A.py │ ├── B.py │ └── C.cc ├── Codeforces Round #715 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.py │ ├── E.cc │ └── F.cc ├── Codeforces Round #717 (Div. 2) │ └── C.py ├── Codeforces Round #741 (Div. 2) │ └── C.py ├── Codeforces Round #747 (Div. 2) │ └── D.cc ├── Codeforces Round #782 (Div. 2) │ ├── B.py │ └── C.py ├── Codeforces Round #836 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── Codeforces Round #FF │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Codeforces Round 135 (Div. 2) │ └── D.cc ├── Codeforces Round 868 (Div. 2) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Codeforces Round 916 (Div. 3) │ ├── E1.py │ ├── E2.py │ └── F.cc ├── Codeforces Round 931 (Div. 2) │ └── D.py ├── Codeforces Round 949 (Div. 2). │ └── C.py ├── Codeforces Round 951 (Div. 2) │ └── D.py ├── Codeforces Round 959 sponsored by NEAR (Div. 1 + Div. 2) │ ├── A.py │ └── B.py ├── Codeforces Round 960 (Div. 2) │ ├── A.py │ ├── B.py │ └── C.cc ├── Codeforces Round 998 (Div. 3) │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 10 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Educational Codeforces Round 102 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.cc ├── Educational Codeforces Round 109 │ └── D.cc ├── Educational Codeforces Round 112 │ └── E.cc ├── Educational Codeforces Round 117 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── Educational Codeforces Round 125 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.cc ├── Educational Codeforces Round 13 │ ├── A.cs │ ├── B.cs │ ├── C.cc │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 14 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Educational Codeforces Round 152 │ └── C.cc ├── Educational Codeforces Round 157 (Rated for Div. 2) │ └── D.cc ├── Educational Codeforces Round 16 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 17 │ └── C.cc ├── Educational Codeforces Round 178 │ ├── A.py │ ├── B.cc │ ├── C.cc │ └── D.cc ├── Educational Codeforces Round 18 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── Educational Codeforces Round 19 │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Educational Codeforces Round 20 │ ├── A.py │ ├── B.cc │ ├── C.py │ ├── D.py │ ├── E.cc │ └── F.cc ├── Educational Codeforces Round 22 │ ├── A.cc │ ├── B.py │ └── C.cc ├── Educational Codeforces Round 25 │ └── F.cc ├── Educational Codeforces Round 27 │ ├── A.py │ ├── B.py │ └── C.py ├── Educational Codeforces Round 30 │ ├── a.py │ ├── b.py │ ├── c.py │ └── d.py ├── Educational Codeforces Round 33 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Educational Codeforces Round 34 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.cc ├── Educational Codeforces Round 39 │ ├── A.py │ ├── B.py │ └── C.py ├── Educational Codeforces Round 49 │ ├── C.py │ └── D.cc ├── Educational Codeforces Round 5 │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.cc │ └── E.cc ├── Educational Codeforces Round 57 │ ├── a.go │ ├── b.py │ ├── c.py │ └── d.py ├── Educational Codeforces Round 67 │ ├── A.py │ └── E.cc ├── Educational Codeforces Round 70 │ └── D.py ├── Educational Codeforces Round 78 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Educational Codeforces Round 80 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 81 │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 83 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 85 │ ├── A.py │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.cc ├── Educational Codeforces Round 96 │ ├── A.py │ ├── B.py │ ├── C.cc │ ├── D.py │ └── E.cc ├── Good Bye 2013 │ ├── D.cc │ ├── a.js │ ├── b.java │ └── c.scala ├── Good Bye 2015 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.cc ├── Good Bye 2016 │ ├── a.py │ ├── b.py │ ├── c.py │ └── d.cc ├── Good Bye 2018 │ ├── a.py │ ├── b.py │ ├── c.py │ └── d.py ├── Hello 2019 │ └── C.py ├── Hello 2020 │ ├── A.py │ ├── B.cc │ └── C.cc ├── School Regional Team Contest, Saratov, 2011 │ └── H.cc └── TypeDB Forces 2023 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── Codewars ├── Character Counter.cs ├── Countdown - Longest Word.py ├── Don't Drink the Water.py ├── Dubstep.cs ├── Find the unique number.py ├── Next bigger number with the same digits.py ├── Number Pairs.cs ├── Number climber.py ├── Number of trailing zeros of N!.py ├── Persistent Bugger.py ├── Playing on a chessboard.py ├── Powers of 2.fs ├── Put a Letter in a Column.cs ├── Rotate for a Max.cs ├── SQL Basics - Simple IN.sql ├── Sum by Factors.py ├── Sums of consecutive integers.cs ├── Triangular Treasure.cs ├── Twice linear.cs ├── Valid Parentheses.py └── Who likes it.py ├── Codility ├── Challenges │ ├── Carol of the Code │ │ └── PrettyTiling.py │ ├── Fast & Curious │ │ └── NewMotorway.py │ ├── Game of Codes │ │ └── ThreeLettersBlocks.cc │ ├── May the 4th Challenge │ │ └── DoubleHanoi.cc │ ├── National Coding Week Challenge │ │ └── LargestString.cc │ ├── Pair a Coder Challenge │ │ └── RemoveSubstrings.cc │ ├── The Doge 2021 │ │ └── PetsAndToys.cc │ ├── The Matrix 2021 │ │ └── MaxSquareOnMatrix.cc │ └── Year of the Tiger │ │ └── TricoloredTowers.cc ├── Lesson01 Iterations │ └── BinaryGap.cc ├── Lesson02 Arrays │ ├── CyclicRotation.py │ └── OddOccurrencesInArray.py ├── Lesson03 Time Complexity │ ├── FrogJmp.scala │ ├── PermMissingElem.py │ ├── TapeEquilibrium.py │ └── Triangle.cc ├── Lesson04 Counting Elements │ ├── FrogRiverOne.cc │ ├── MaxCounters.cc │ ├── MissingInteger.cc │ └── PermCheck.cc ├── Lesson05 Prefix Sums │ ├── CountDiv.cc │ ├── GenomicRangeQuery.cc │ ├── MinAvgTwoSlice.cc │ └── PassingCars.cc ├── Lesson06 Sorting │ ├── Distinct.py │ ├── MaxProductOfThree.py │ └── NumberOfDiscIntersections.py ├── Lesson07 Stacks and Queues │ ├── Brackets.cc │ ├── Fish.cc │ ├── Nesting.cc │ └── StoneWall.cc ├── Lesson08 Leader │ ├── Dominator.py │ └── EquiLeader.cc ├── Lesson09 Maximum slice problem │ ├── MaxDoubleSliceSum.cc │ ├── MaxProfit.cc │ └── MaxSliceSum.cc ├── Lesson10 Prime and composite numbers │ ├── CountFactors.cc │ ├── Flags.cc │ ├── MinPerimeterRectangle.cc │ └── Peaks.cc ├── Lesson11 Sieve of Eratosthenes │ ├── CountNonDivisible.cc │ └── CountSemiprimes.cc ├── Lesson12 Euclidean algorithm │ ├── ChocolatesByNumbers.java │ └── CommonPrimeDivisors.py ├── Lesson13 Fibonacci numbers │ ├── FibFrog.cc │ └── Ladder.cc ├── Lesson14 Binary search algorithm │ ├── MinMaxDivision.cc │ └── NailingPlanks.cc └── Lesson15 Caterpillar method │ ├── AbsDistinct.py │ ├── CountDistinctSlices.py │ ├── CountTriangles.cc │ └── MinAbsSumOfTwo.cc ├── Dsy_OJ ├── 1045.cc └── 1499.cc ├── Exemplars ├── Common IO.cc ├── DP │ ├── LCS.cc │ └── 编辑距离.cc ├── Data Generator │ ├── Geometry │ │ └── Convex Hull.cpp │ ├── Graph │ │ ├── directed_graph.py │ │ └── undirected_graph.py │ └── generator.py ├── Java │ └── BigInteger.java ├── MurmurHashFactor.cc ├── Utils │ └── interactive.py ├── 图论 │ ├── 2-SAT │ │ ├── 2-SAT 字典序解.cc │ │ ├── 2-SAT 输出任意解.cc │ │ ├── 2-SAT.cc │ │ ├── 2_SAT定理.txt │ │ └── README │ ├── Floyed求最小环.cc │ ├── SPFA次短路.cc │ ├── SPFA求负环.cc │ ├── dijkstra_heap.cc │ ├── 「回路」欧拉(汉密尔顿)回路.cc │ ├── 「图论」SPFA.cc │ ├── 「图论」二维SPFA.cc │ ├── 「图论」全局最大流-最小割.cc │ ├── 「图论」求图中的环.cc │ ├── 「图论」稳定婚姻问题.cc │ ├── 「平面图最小割」网格图.cc │ ├── 「树」最近公共祖先LCA.cc │ ├── 「树」树上所有点在树上的最长路.cc │ ├── 二分图 │ │ ├── [二分图] HK算法 - O(Esqrt(V)).cc │ │ ├── [二分图] 二分图一对多匹配(多重匹配).cc │ │ ├── 「二分图」KM算法.cc │ │ ├── 「二分图」匈牙利算法.cc │ │ ├── 「二分图」匈牙利算法输出解.cc │ │ ├── 「二分图」有向图最优边权覆盖.cc │ │ ├── 「二分图+SCC」全部完美匹配.cc │ │ ├── 有向图K边不共点最小覆盖.cc │ │ ├── 结论.txt │ │ └── [二分图]点权不等式匹配.cc │ ├── 最大流 │ │ ├── Dinic速度快.cc │ │ ├── Dinic静态内存.cc │ │ ├── README │ │ ├── sap.cc │ │ ├── 「姿势优美」Dinic.cc │ │ ├── 「最小费用流」消圈更优解.cc │ │ ├── 最小费用最大流.cc │ │ └── 有费用限制的最小费用流.cc │ └── 连通分量 │ │ ├── README │ │ ├── Tarjan - 强连通分量.cc │ │ ├── Tarjan-点双连通分量.cc │ │ ├── Tarjan-边双连通分量-将无向图转化为强连通分量.cc │ │ ├── 判定一个给定的序列是否是可图.cc │ │ ├── 点双连通分量求(奇)环.cc │ │ └── 结论.txt ├── 字符串 │ ├── AC自动机.cc │ ├── KMP求Fail指针(小数据).cc │ ├── README │ ├── Z-algorithm.cc │ ├── Z-algorithm.py │ ├── kmp.py │ ├── z-function求字符串循环节.py │ ├── 「字符串」KMP.cc │ ├── 编辑距离.cc │ └── [最长回文串]Manacher.cc ├── 数学 │ ├── Py高精度计算.py │ ├── 中国剩余定理.cc │ ├── 中国剩余定理.py │ ├── 乘法逆元.py │ ├── 容斥原理与Lucas定理.cc │ ├── 扩展欧几里德与乘法逆元.cc │ ├── 整数分拆.cc │ ├── 矩阵乘法.cc │ ├── 矩阵乘法(模板类).cc │ ├── 计算pi值.py │ ├── 高斯分布的概率积分.py │ └── 高斯消元.cc ├── 数据结构 │ ├── AVL.cc │ ├── SBT.cc │ ├── [乱搞]维护字典中最大value.cc │ ├── 「RMQ」离线区间最大最小值.cc │ ├── 「分段哈希」区间覆盖-特定颜色个数查询.cc │ ├── 「划分树」求区间第K小值.cc │ ├── 主席树-求区间第k大.cc │ ├── 分段哈希.cc │ ├── 动态树 │ │ ├── 「动态内存」Treap.cc │ │ └── 「静态内存」Treap(慎用).cc │ ├── 小根堆.cc │ ├── 左偏树 - Leftist Tree.cc │ ├── 树状数组 │ │ ├── [面向对象]树状数组.cc │ │ ├── 「二维数状数组」矩阵区间更新-点查询.cc │ │ ├── 「二维树状数组」矩阵点更新-区间查询.cc │ │ ├── 「树状数组」区间-点数值统计.cc │ │ ├── 「树状数组」在线求区间最大值.cc │ │ ├── 「树状数组」求第K值.cc │ │ └── 树状数组.py │ ├── 树转化为数组.cc │ └── 线段树 │ │ ├── 「线段树」区间乘法加法.cc │ │ ├── 「线段树」区间修改、合并、查询最长区间.cc │ │ ├── 「线段树」区间修改查询最大最小值.cc │ │ ├── 「线段树」区间更新--查询区间和.cc │ │ ├── 「线段树」区间更新--查询点的值.cc │ │ ├── 「线段树」区间覆盖-最长区间查询.cc │ │ ├── 「线段树」求区间中位数.cc │ │ └── 「线段树」线段染色问题,区间更新,查询点.cc ├── 数论 │ ├── Miller-Rabin.py │ ├── Pell Equation.py │ ├── README │ ├── xor_sum.py │ ├── 反素数.cc │ ├── 欧拉函数.cc │ ├── 求一个数是由多少不同质数之和组成.cc │ ├── 求地板除的和.cc │ ├── 求地板除的和.py │ ├── 素性检验--快速分解质因数.cc │ └── 质数.cc ├── 杂项 │ ├── Expression Evaluation.cc │ ├── PyPy输入输出挂.py │ ├── Python递归开栈.py │ ├── README │ ├── murmurhash.cc │ ├── 三分法解凸性函数极值.cc │ ├── 希尔排序.cc │ ├── 整数三分法.cc │ ├── 时间计算.cc │ ├── 曼哈顿距离与切比雪夫距离.txt │ ├── 枚举二进制状态子集.cc │ ├── 模拟退火(Simulated annealing).cc │ ├── 矩阵乘.cc │ ├── 科学表示法.cc │ ├── 表达式求值.py │ ├── 表达式求值(带括号).cc │ └── 运算式求值.cc ├── 离线算法 │ ├── 整体二分(区间更改,区间第k大).cc │ └── 整体二分(单点修改,区间第k大).cc └── 计算几何 │ ├── [立体几何]四点共面.py │ └── 平面几何 │ ├── [平面几何]整点线段上整点的个数.cc │ ├── 「平面几何」Pick公式计算内部整点个数.cc │ ├── 「平面几何」两个凸包的最近点对.cc │ ├── 「平面几何」凸包.cc │ ├── 「平面几何」凸包最大三角形.cc │ ├── 「平面几何」凸包过门问题.cc │ ├── 「平面几何」圆.cc │ ├── 「平面几何」多边形.cc │ ├── 「平面几何」多边形与圆的交.cc │ ├── 「平面几何」平面最近点对.cc │ ├── 「平面几何」求多边形重心.cc │ ├── 「平面几何」点、直线、线段.cc │ └── 「平面几何」重要定理.txt ├── Google Code Jam ├── Kickstart 2017 │ ├── Kickstart Practice Round 2017 │ │ ├── A.py │ │ ├── B.py │ │ └── C.py │ ├── Kickstart Round A 2017 │ │ ├── A.cc │ │ └── C.cc │ ├── Kickstart Round B 2017 │ │ └── A.py │ ├── Kickstart Round D 2017 │ │ └── A.cc │ ├── Kickstart Round F 2017 │ │ ├── A.py │ │ ├── B.py │ │ └── D.py │ └── Kickstart Round G 2017 │ │ ├── A.py │ │ ├── B.cc │ │ └── C.cc ├── Kickstart 2018 │ ├── Kickstart Round F 2018 │ │ └── A.py │ ├── Kickstart Round G 2018 │ │ └── A.py │ └── Kickstart Round H 2018 │ │ ├── A.py │ │ ├── B.py │ │ └── C.py ├── Kickstart 2020 │ ├── Kickstart Round A 2020 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.py │ │ └── D.py │ └── Kickstart Round E 2020 │ │ ├── A.py │ │ ├── B.py │ │ └── C.cc ├── Kickstart 2021 │ ├── Kickstart Round A 2021 │ │ ├── A - K-Goodness String.py │ │ ├── B - L Shaped Plots.py │ │ ├── C - Rabbit House.cc │ │ └── D - Checksum.cc │ ├── Kickstart Round B 2021 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.py │ │ └── D.cc │ └── Kickstart Round D 2021 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.cc │ │ └── D.cc ├── Kickstart 2022 │ ├── Coding Practice with Kick Start Session #1 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.py │ │ ├── D.cc │ │ └── E.cc │ ├── Kickstart Round A 2022 │ │ ├── A.cc │ │ ├── B.cc │ │ ├── C.cc │ │ └── D.cc │ ├── Kickstart Round B 2022 │ │ ├── A.py │ │ ├── B.py │ │ └── C.cc │ ├── Kickstart Round C 2022 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.cc │ │ └── D.cc │ ├── Kickstart Round D 2022 │ │ ├── A.py │ │ ├── B.py │ │ ├── C.cc │ │ └── D.cc │ ├── Kickstart Round E 2022 │ │ ├── A.cc │ │ ├── B.cc │ │ ├── C.cc │ │ └── D.cc │ └── Kickstart Round F 2022 │ │ ├── A.py │ │ ├── B.cc │ │ ├── C.cc │ │ └── D.cc ├── Qualification Round 2015 │ ├── A │ │ └── A.py │ ├── B │ │ └── B.cc │ └── C │ │ └── C.cc ├── Qualification Round 2017 │ ├── A.py │ ├── B.py │ └── C.cc ├── Qualification Round 2019 │ ├── A.py │ ├── B.py │ ├── C.py │ └── D.py ├── Qualification Round 2020 │ ├── A.py │ ├── B.py │ ├── C.cc │ └── D.py ├── Qualification Round 2021 │ ├── A.cc │ ├── B.py │ ├── C.py │ ├── D.py │ └── E.py ├── Round 1A 2008 │ └── A.py ├── Round 1A 2018 │ ├── A.cc │ └── B.py ├── Round 1A 2020 │ ├── A.py │ ├── B.py │ └── C.cc ├── Round 1B 2015 │ └── B.py ├── Round 1B 2016 │ ├── A.py │ ├── B.large.py │ ├── B.small.py │ └── C.cc ├── Round 1B 2020 │ ├── A.py │ ├── B.py │ └── C.py ├── Round 1C 2009 │ └── C.cc ├── Round 1C 2016 │ ├── A.py │ └── B.py ├── Round 1C 2018 │ ├── A.cc │ ├── B.py │ └── C.cc ├── Round 1C 2019 │ ├── A.py │ └── B.py ├── Round 1C 2020 │ └── B.cc ├── Round 2 2009 │ └── A.py ├── Round 2 2016 │ └── A.cc ├── Round 2 2017 │ ├── A.cc │ └── B.cc ├── Round 2 2018 │ ├── A.py │ ├── B.cc │ ├── C.cc │ └── D.1.py └── Round 2 2020 │ ├── A.py │ ├── B.cc │ └── C.py ├── HDU OJ ├── 1 │ ├── 1001.cs │ ├── 1002.java │ ├── 1003.cc │ ├── 1004.cc │ ├── 1005.cc │ ├── 1006.cc │ ├── 1007.cc │ ├── 1008.cc │ ├── 1009.cc │ ├── 1012.cc │ ├── 1024.cc │ ├── 1029.cc │ ├── 1069.cc │ ├── 1074.cc │ ├── 1078.cc │ ├── 1081.cc │ ├── 1086.cc │ ├── 1087.cc │ ├── 1114.cc │ ├── 1142.cc │ ├── 1159.cc │ ├── 1160.cc │ ├── 1162.cc │ ├── 1166.cc │ ├── 1176.cc │ ├── 1203.cc │ ├── 1257.cc │ ├── 1260.cc │ ├── 1290.cc │ ├── 1358.cc │ ├── 1400.cc │ ├── 1427.cc │ ├── 1428.cc │ ├── 1506.cc │ ├── 1520.cc │ ├── 1522.cc │ ├── 1540.cc │ ├── 1542.cc │ ├── 1589.cc │ ├── 1677.cc │ ├── 1686.cc │ ├── 1693.cc │ ├── 1698.cc │ ├── 1711.cc │ ├── 1728.cc │ ├── 1754.cc │ ├── 1796.cc │ ├── 1814.cc │ ├── 1850.cc │ ├── 1875.cc │ └── 1937.cc ├── 2 │ ├── 2009.cc │ ├── 2087.cc │ ├── 2094.cc │ ├── 2108.cc │ ├── 2204.cc │ ├── 2222.cc │ ├── 2255.cc │ ├── 2289.cc │ ├── 2444.cc │ ├── 2446.cc │ ├── 2448.cc │ ├── 2451.cc │ ├── 2454.cc │ ├── 2464.cc │ ├── 2473.cc │ ├── 2474.cc │ ├── 2476.cc │ ├── 2483.cc │ ├── 2485.cc │ ├── 2490.cc │ ├── 2491.cc │ ├── 2500.java │ ├── 2512.cc │ ├── 2514.cc │ ├── 2570.cc │ ├── 2586.cc │ ├── 2594.cc │ ├── 2665.cc │ ├── 2680.cc │ ├── 2795.cc │ ├── 2796.cc │ ├── 2841.cc │ ├── 2859.cc │ ├── 2896.cc │ ├── 2977.cc │ └── 2984.cc ├── 3 │ ├── 3007.cc │ ├── 3037.cc │ ├── 3065.cc │ ├── 3177.cc │ ├── 3208.cc │ ├── 3220.cc │ ├── 3231.cc │ ├── 3234.cc │ ├── 3244.cc │ ├── 3263.cc │ ├── 3336.cc │ ├── 3394.cc │ ├── 3408.cc │ ├── 3410.cc │ ├── 3415.cc │ ├── 3511.cc │ ├── 3530.cc │ ├── 3548.cc │ ├── 3549.cc │ ├── 3555.cc │ ├── 3622.cc │ ├── 3652.cc │ ├── 3670.cc │ ├── 3680.java │ ├── 3681.cc │ ├── 3682.cc │ ├── 3685.cc │ ├── 3689.cc │ ├── 3691.cc │ ├── 3694.cc │ ├── 3696.cc │ ├── 3699.cc │ ├── 3709.cc │ ├── 3714.cc │ ├── 3715.cc │ ├── 3718.cc │ ├── 3720.cc │ ├── 3722.cc │ ├── 3724.cc │ ├── 3727.cc │ ├── 3729.cc │ ├── 3746.cc │ ├── 3753.cc │ ├── 3804.cc │ ├── 3834.cc │ ├── 3870.cc │ ├── 3874.cc │ ├── 3881.cc │ ├── 3887.cc │ ├── 3925.java │ ├── 3949.cc │ ├── 3964.cc │ └── 3974.cc ├── 4 │ ├── 4000.cc │ ├── 4006.cc │ ├── 4024.cc │ ├── 4027.cc │ ├── 4028.cc │ ├── 4031.cc │ ├── 4033.cc │ ├── 4034.cc │ ├── 4036.cc │ ├── 4039.cc │ ├── 4082.cc │ ├── 4115.cc │ ├── 4118.cc │ ├── 4121.cc │ ├── 4122.cc │ ├── 4123.cc │ ├── 4190.cc │ ├── 4217.cc │ ├── 4263.cc │ ├── 4267.cc │ ├── 4268.cc │ ├── 4272.cc │ ├── 4277.cc │ ├── 4278.cc │ ├── 4279.cc │ ├── 4280.cc │ ├── 4282.cc │ ├── 4283.cc │ ├── 4284.cc │ ├── 4287.cc │ ├── 4288.cc │ ├── 4289.cc │ ├── 4292.cc │ ├── 4300.cc │ ├── 4311.cc │ ├── 4312.cc │ ├── 4318.cc │ ├── 4320.cc │ ├── 4324.cc │ ├── 4325.cc │ ├── 4329.cc │ ├── 4334.cc │ ├── 4336.cc │ ├── 4337.cc │ ├── 4339.cc │ ├── 4344.cc │ ├── 4345.cc │ ├── 4348.cc │ ├── 4351.cc │ ├── 4352.cc │ ├── 4355.cc │ ├── 4358.cc │ ├── 4360.cc │ ├── 4362.cc │ ├── 4364.cc │ ├── 4365.cc │ ├── 4366.cc │ ├── 4380.cc │ ├── 4381.cc │ ├── 4386.cc │ ├── 4389.cc │ ├── 4391.cc │ ├── 4393.cc │ ├── 4394.cc │ ├── 4395.cc │ ├── 4396.cc │ ├── 4398.cc │ ├── 4407.cc │ ├── 4411.cxx │ ├── 4417.cc │ ├── 4460.cc │ ├── 4507.cc │ ├── 4614.cc │ ├── 4632.cc │ ├── 4734.cc │ ├── 4768.cc │ ├── 4831.cc │ ├── 4832.cc │ ├── 4834.cc │ ├── 4861.cc │ ├── 4862.cc │ ├── 4864.cc │ ├── 4869.cc │ ├── 4870.cc │ └── 4911.cc ├── 5 │ ├── 5178.cc │ ├── 5256.cc │ ├── 5305.cc │ ├── 5323.cc │ ├── 5355.cc │ ├── 5358.cc │ ├── 5385.cc │ ├── 5441.cc │ ├── 5493.cc │ ├── 5646.cc │ └── 5672.cc └── 6 │ ├── 6033.cc │ ├── 6034.cc │ ├── 6035.cc │ ├── 6038.cc │ ├── 6043.cc │ ├── 6045.cc │ ├── 6047.cc │ ├── 6050.cc │ ├── 6053.cc │ ├── 6055.cc │ ├── 6298.cc │ ├── 6299.cc │ ├── 6300.cc │ ├── 6301.cc │ ├── 6304.cc │ ├── 6308.cc │ ├── 6318.cc │ ├── 6322.cc │ ├── 6324.cc │ ├── 6380.cc │ ├── 6383.cc │ ├── 6668.cc │ ├── 6669.cc │ ├── 6672.cc │ ├── 6838.cc │ ├── 6839.cc │ └── 6840.cc ├── HIT OJ └── 1867.cc ├── HackerRank ├── Algorithms │ ├── Bit Manipulation │ │ ├── 2's complement.py │ │ ├── A or B.py │ │ ├── AND product.cc │ │ ├── Cipher.cc │ │ ├── Counter game.py │ │ ├── Flipping bits.py │ │ ├── Lonely Integer.py │ │ ├── Manipulative Numbers.py │ │ ├── Sum vs XOR.py │ │ ├── The Great XOR.py │ │ └── Yet Another Minimax Problem.cc │ ├── Constructive Algorithms │ │ ├── New Year Chaos.cs │ │ ├── Flipping the Matrix.py │ │ ├── Inverse RMQ.cc │ │ └── Yet Another KMP Problem.py │ ├── Dynamic-Programming │ │ ├── Candies.py │ │ ├── Equal.py │ │ ├── Fibonacci Modified.py │ │ ├── Find the Seed.cc │ │ ├── Red John is Back.cc │ │ ├── Stock Maximize.cc │ │ ├── Superman Celebrates Diwali.cc │ │ ├── The Blacklist.cc │ │ ├── The Coin Change Problem.cc │ │ ├── The Maximum Subarray.cc │ │ └── Wet Shark and Two Subsequences.cc │ ├── Game Theory │ │ ├── A Chessboard Game.cc │ │ ├── Alice and Bob's Silly Game.py │ │ ├── Game of Stones.py │ │ ├── Introduction to Nim Game.py │ │ ├── New Year Game.py │ │ ├── Nimble Game.py │ │ ├── Poker Nim.py │ │ ├── Tower Breakers, Revisited!.py │ │ ├── Tower Breakers.py │ │ └── Zero-Move Nim.py │ ├── Graph Theory │ │ ├── Even Tree.cc │ │ ├── Kingdom Connectivity.cc │ │ ├── Kruskal (MST) - Really Special Subtree.cc │ │ ├── Misère Nim.py │ │ ├── Prim_s (MST) - Special Subtree.cc │ │ ├── Roads and Libraries.cc │ │ └── Roads in HackerLand.cc │ ├── Greedy │ │ ├── Priyanka and Toys.py │ │ └── Sherlock and MiniMax.py │ ├── Implementation │ │ ├── ACM ICPC Team.cc │ │ ├── Absolute Permutation.cc │ │ ├── Angry Professor.py │ │ ├── Append and Delete.py │ │ ├── Beautiful Triplets.py │ │ ├── Between Two Sets.py │ │ ├── Birthday Chocolate.py │ │ ├── Breaking the Records.py │ │ ├── Cats and a Mouse.py │ │ ├── Cavity Map.cc │ │ ├── Climbing the Leaderboard.py │ │ ├── Counting Valleys.py │ │ ├── Day of the Programmer.py │ │ ├── Designer PDF Viewer.go │ │ ├── Divisible Sum Pairs.cs │ │ ├── Electronics Shop.py │ │ ├── Equal Stacks.cs │ │ ├── Fair Rations.cs │ │ ├── Forming a Magic Square.py │ │ ├── Grading Students.py │ │ ├── Greedy Florist.py │ │ ├── Jim and the Orders.py │ │ ├── Jumping on the Clouds.py │ │ ├── Kangaroo.cs │ │ ├── Larry's Array.cs │ │ ├── Lisa's Workbook.cs │ │ ├── Migratory Birds.py │ │ ├── Mini-Max Sum.go │ │ ├── Minimum Distances.cs │ │ ├── Modified Kaprekar Numbers.py │ │ ├── New Year Chaos.cs │ │ ├── Non-Divisible Subset.cs │ │ ├── Picking Numbers.py │ │ ├── Repeated String.py │ │ ├── Sequence Equation.py │ │ ├── Service Lane.cs │ │ ├── Sherlock and Squares.fs │ │ ├── Sherlock and The Beast.fs │ │ ├── Sock Merchant.py │ │ ├── Taum and B'day.py │ │ ├── The Bomberman Game.cc │ │ ├── The Hurdle Race.py │ │ ├── The Time in Words.py │ │ └── [Algo] Matrix Rotation.cc │ ├── Recursion │ │ ├── Bowling Pins.py │ │ ├── K Factorization.py │ │ ├── Recursive Digit Sum.py │ │ └── The Power Sum.py │ ├── Search │ │ ├── Ice Cream Parlor.py │ │ └── KnightL on a Chessboard.cc │ ├── Sorting │ │ ├── Almost Sorted.py │ │ ├── Big Sorting.py │ │ ├── Counting Sort 1.py │ │ ├── Insertion Sort Advanced Analysis.cc │ │ ├── Quicksort 1.cc │ │ ├── Sherlock and Pairs.py │ │ └── Sherlock and Watson.cs │ ├── Strings │ │ ├── Alternating Characters.cc │ │ ├── Anagram.py │ │ ├── Beautiful Binary String.cc │ │ ├── Bigger is Greater.cc │ │ ├── Caesar Cipher.py │ │ ├── CamelCase.py │ │ ├── Common Child.cc │ │ ├── Funny String.cc │ │ ├── Game of Thrones - I.py │ │ ├── Gem Stones.py │ │ ├── HackerRank in a String.py │ │ ├── Highest Value Palindrome.py │ │ ├── Make it Anagram.cc │ │ ├── Palindrome Index.cc │ │ ├── Pangrams.py │ │ ├── Reverse Shuffle Merge.cc │ │ ├── Sherlock and Anagrams.py │ │ ├── Sherlock and the Valid String.py │ │ ├── Super Reduced String.py │ │ ├── Two Characters.py │ │ ├── Two Strings.py │ │ └── Weighted Uniform Strings.py │ └── WarmUp │ │ ├── A Very Big Sum.cs │ │ ├── Angry Children.py │ │ ├── Birthday Cake Candles.go │ │ ├── Birthday Cake Candles.py │ │ ├── Compare the Triplets.py │ │ ├── Cut the sticks.py │ │ ├── Diagonal Difference.cs │ │ ├── Extra long factorials.py │ │ ├── Filling Jars.cc │ │ ├── Find Digits.py │ │ ├── Maximizing XOR.cc │ │ ├── Maximum Perimeter Triangle.py │ │ ├── Plus Minus.cs │ │ ├── Save the Prisoner.cc │ │ ├── Simple Array Sum.py │ │ ├── Solve Me First.lua │ │ ├── Staircase.lua │ │ ├── The Love-Letter Mystery.py │ │ └── Time Conversion.py ├── All Contests │ ├── 20 20 Hack March │ │ └── Xoring Ninja.py │ ├── Booking.com Back End CodeSprint │ │ ├── Coupling Passions.py │ │ ├── Destination: Together <3.py │ │ ├── Event Raffle.cc │ │ ├── Good Memories.py │ │ ├── Northern Tour.cc │ │ └── Reviews.py │ ├── HackerRank Hiring Contest │ │ ├── Array and Queries.py │ │ ├── Programming Competition.py │ │ ├── The Simplest Sum.py │ │ └── Winning Lottery Ticket.cc │ ├── HourRank 10 │ │ ├── Accessory Collection.py │ │ ├── Jumping on the Clouds - Revisited.cs │ │ └── The Bomberman Game.cs │ ├── HourRank 21 │ │ └── Who Gets the Catch?.py │ ├── HourRank 22 │ │ ├── A.py │ │ └── B.cc │ ├── HourRank 24 │ │ ├── Strong Password.py │ │ └── Wire Removal.cc │ ├── HourRank 25 │ │ ├── Constructing a Number.py │ │ └── Maximum Palindromes.py │ ├── HourRank 29 │ │ ├── Array Partition.cc │ │ └── Customized Chess Board.py │ ├── HourRank 30 │ │ └── Jerry's Expression.cc │ ├── HourRank 31 │ │ ├── Hanging Posters.py │ │ └── Save the Queen.py │ ├── HourRank 5 │ │ └── Xor-sequence.py │ ├── ProjectEuler+ │ │ ├── 001.py │ │ ├── 002.py │ │ ├── 003.py │ │ ├── 004.cc │ │ ├── 005.py │ │ ├── 006.py │ │ ├── 007.py │ │ ├── 008.py │ │ ├── 009.py │ │ ├── 010.py │ │ ├── 011.py │ │ ├── 012.py │ │ ├── 013.py │ │ ├── 014.py │ │ ├── 015.py │ │ ├── 016.py │ │ ├── 017.py │ │ ├── 018.py │ │ ├── 019.py │ │ ├── 020.py │ │ ├── 021.py │ │ ├── 022.py │ │ ├── 023.py │ │ ├── 024.py │ │ └── 025.py │ ├── Week of Code 36 │ │ └── Acid Naming.py │ └── World CodeSprint 9 │ │ ├── Grading Students.py │ │ ├── Kingdom Division.cc │ │ ├── Queen's Attack II.py │ │ ├── Toll Cost Digits.cc │ │ └── Weighted Uniform Strings.py ├── Artificial Intelligence │ └── Natural Language Processing │ │ └── From Paragraphs to Sentences.py ├── CPP │ ├── Classes │ │ └── Structs.cc │ ├── Inheritance │ │ └── Accessing Inherited Functions.cc │ └── Introduction │ │ └── For Loop.cpp ├── Data Structures │ ├── Arrays │ │ ├── 2D Array - DS.cc │ │ ├── Array Manipulation.cc │ │ ├── Arrays - DS.fs │ │ ├── Dynamic Array.cc │ │ ├── Left Rotation.fs │ │ └── Sparse Arrays.py │ ├── Balanced Trees │ │ ├── Median Updates.cc │ │ └── Self Balancing Tree.cc │ ├── Binary Search Tree │ │ ├── Binary Search Tree : Insertion.cc │ │ └── Lowest Common Ancestor.cc │ ├── Disjoint Set │ │ ├── Components in a graph.py │ │ ├── Kundu and Tree.py │ │ └── Merging Communities.cc │ ├── Heap │ │ └── QHEAP1.cs │ ├── Linked Lists │ │ ├── Cycle Detection.py │ │ ├── Delete duplicate-value nodes from a sorted linked list.cc │ │ ├── Find Merge Point of Two Lists.py │ │ ├── Insert a Node at the Tail of a Linked List.py │ │ ├── Insert a node at the head of a linked list.py │ │ ├── Print the Elements of a Linked List.py │ │ ├── Reverse a doubly linked list.cc │ │ └── Reverse a linked list.cc │ ├── Queues │ │ ├── Castle on the Grid.cs │ │ ├── Down to Zero II.cc │ │ ├── Jesse and Cookies.py │ │ └── Truck Tour.py │ ├── Stacks │ │ ├── AND xor OR.cc │ │ ├── Balanced Brackets.py │ │ ├── Game of Two Stacks.py │ │ ├── Largest Rectangle.cc │ │ ├── Simple Text Editor.py │ │ └── Waiter.cc │ └── Tree │ │ ├── Height of a binary tree.cc │ │ ├── Inorder Traversal.cc │ │ ├── Is This a Binary Search Tree.cc │ │ ├── Preorder Traversal.cc │ │ ├── Swap Nodes [Algo].cc │ │ ├── Top View.cc │ │ ├── Tree: Level Order Traversal.py │ │ └── Tree: Postorder Traversal.cc ├── Databases │ └── Relational-Algebra │ │ └── Basics of Sets and Relations #1.txt ├── Distributed Systems │ ├── Client Server │ │ └── UDS Echo Server.cc │ └── MapReduce Basics │ │ ├── Map Reduce Tutorials - #1 Word Counts.py │ │ └── Map Reduce Tutorials - #2 The Group By Operator.py ├── Functional Programming │ ├── Introduction │ │ ├── Evaluating e^x.fs │ │ ├── Filter Array.fs │ │ ├── Functions or Not.fs │ │ ├── Hello World N Times.fs │ │ ├── Hello World.erl │ │ ├── Lambda Calculus - Reductions #1.txt │ │ ├── Lambda Calculus - Reductions #2.txt │ │ ├── Lambda Calculus - Reductions #3.txt │ │ ├── Lambda Calculus - Reductions #4.txt │ │ ├── Reverse a List.fs │ │ ├── Solve Me First FP.fs │ │ └── Update List.fs │ └── Recursion │ │ ├── Computing the GCD.scl │ │ ├── Fibonacci Numbers.fs │ │ └── String Mingling.ml ├── Linux Shell │ ├── Bash │ │ ├── A Personalized Echo.sh │ │ ├── Arithmetic Operations.sh │ │ ├── Comparing Numbers.sh │ │ ├── Compute the Average.sh │ │ ├── Getting started with conditionals.sh │ │ ├── Lets Echo.sh │ │ ├── Looping and Skipping.sh │ │ ├── Looping with Numbers.sh │ │ ├── More on Conditionals.sh │ │ ├── Read in an Array.sh │ │ ├── Slice an Array.sh │ │ └── The World of Numbers.sh │ ├── Grep Sed Awk │ │ ├── 'Awk' - 1.sh │ │ ├── 'Awk' - 2.sh │ │ ├── 'Awk' - 4.sh │ │ ├── 'Grep' #1.sh │ │ ├── 'Grep' #2.sh │ │ ├── 'Grep' #3.sh │ │ ├── 'Grep' - A.sh │ │ └── Awk - 3.sh │ └── Text Processing │ │ ├── 'Sort' command #6.sh │ │ ├── 'Sort' command #7.sh │ │ ├── 'Tr' Command #3.sh │ │ ├── 'Uniq' command #3.sh │ │ ├── 'Uniq' command #4.sh │ │ ├── Cut #4.sh │ │ ├── Cut #5.sh │ │ ├── Cut #6.sh │ │ ├── Cut #7.sh │ │ ├── Cut #8.sh │ │ ├── Cut #9.sh │ │ ├── Day 1: Cut #1.sh │ │ ├── Day 1: Cut #2.sh │ │ ├── Day 1: Cut #3.sh │ │ ├── Day 2: Head of a Text File #1.sh │ │ ├── Day 2: Head of a Text File #2.sh │ │ ├── Day 2: Tail of a Text File #1.sh │ │ ├── Day 2: Tail of a Text File #2.sh │ │ ├── Day 3: 'Tr' Command #1.sh │ │ ├── Day 3: 'Tr' Command #2.sh │ │ ├── Day 3: Sort Command #1.sh │ │ ├── Day 3: Sort Command #2.sh │ │ ├── Day 4: 'Uniq' Command #1.sh │ │ ├── Day 4: 'Uniq' Command #2.sh │ │ ├── Day 4: Paste - 2.sh │ │ ├── Middle of A Text File.sh │ │ ├── Paste - 1.sh │ │ ├── Paste - 3.sh │ │ ├── Paste - 4.sh │ │ ├── Sort Command #4.sh │ │ └── Sort Command #5.sh ├── Mathematics │ ├── Algebra │ │ ├── Easy sum.py │ │ ├── Shashank and List.py │ │ ├── Sherlock and Square.py │ │ └── Tell the Average.py │ ├── Combinatorics │ │ ├── Anti-Palindromic Strings.py │ │ ├── Building a List.py │ │ ├── Choose and Calculate.py │ │ ├── Coinage.py │ │ ├── Consecutive Subsequences.py │ │ ├── Digit Products.cc │ │ ├── Journey to Mars.py │ │ ├── Lexicographic paths.py │ │ ├── Longest Increasing Subsequence Arrays.go │ │ ├── Mehta and the Typical Supermarket.py │ │ ├── Merge List.py │ │ ├── Number List.py │ │ ├── Picking Cards.py │ │ ├── Super Humble Matrix.py │ │ └── nCr table.py │ ├── Fundamentals │ │ ├── Die Hard 3.py │ │ ├── Find Point.py │ │ ├── Halloween party.py │ │ ├── Handshake.scl │ │ ├── Is Fibo.py │ │ ├── Jim and the Jokes.py │ │ ├── K Candy Store.py │ │ ├── Maximum Draws.scl │ │ ├── Minimum Height Triangle.py │ │ ├── Most Distant.py │ │ ├── Possible Path.scl │ │ ├── Restaurant.py │ │ └── Sumar and the Floating Rocks.py │ ├── Geometry │ │ ├── A Circle and a Square.py │ │ └── Jim Beam.cc │ ├── Linear Algebra Foundations │ │ ├── Linear Algebra Foundations #1 - Matrix Addition.txt │ │ └── Linear Algebra Foundations #2 - Matrix Subtraction.txt │ ├── Number Theory │ │ ├── Akhil and GF.py │ │ ├── Closest Number.py │ │ ├── Eugene and Big Number.py │ │ ├── Fibonacci Finding (easy).cc │ │ ├── Power of large numbers.py │ │ ├── Primitive Problem.py │ │ ├── Superpowers of 2.py │ │ ├── The Chosen One.py │ │ └── Unfriendly Numbers.cc │ └── Probability │ │ ├── Day 4: Normal Distribution #1.py │ │ ├── Extremely Dangerous Virus.py │ │ ├── Random number generator.py │ │ └── Sherlock and Probability.cc ├── Python │ ├── Introduction │ │ └── Python If-Else.py │ ├── Sets │ │ └── Introduction to Sets.py │ └── Strings │ │ ├── String Split and Join.py │ │ ├── Text Alignment.py │ │ ├── The Minion Game.py │ │ └── sWAP cASE.py ├── Regex │ ├── Applications │ │ ├── Building a Smart IDE: Identifying comments.py │ │ ├── Detect HTML links.py │ │ ├── Detect the Domain Name.py │ │ ├── Detect the Email Addresses.py │ │ ├── Detecting Valid Latitude and Longitude Pairs.py │ │ ├── Find Hackerrank.py │ │ ├── HackerRank Language.py │ │ ├── HackerRank Tweets.py │ │ ├── Saying Hi.py │ │ ├── Utopian Identification Number.py │ │ └── Valid PAN format.py │ ├── Backreferences │ │ ├── Backreferences To Failed Groups.py │ │ ├── Branch Reset Groups.php │ │ ├── Forward References.php │ │ └── Matching Same Text Again & Again.py │ ├── Character Class │ │ ├── Excluding Specific Characters.py │ │ ├── Matching Character Ranges.py │ │ └── Matching Specific Characters.py │ ├── Grouping and Capturing │ │ ├── Alternative Matching.py │ │ ├── Capturing & Non-Capturing Groups.py │ │ └── Matching Word Boundaries.py │ ├── Introduction │ │ ├── Matching Start & End.py │ │ ├── Matching Anything But a Newline.py │ │ ├── Matching Digits & Non-Digit Characters.py │ │ ├── Matching Specific String.py │ │ ├── Matching Whitespace & Non-Whitespace Character.py │ │ └── Matching Word & Non-Word Character.py │ └── Repetitions │ │ ├── Matching Ending Items.py │ │ ├── Matching One Or More Repetitions.py │ │ ├── Matching Zero Or More Repetitions.py │ │ ├── Matching {x, y} Repetitions.py │ │ └── Matching {x} Repetitions.py ├── SQL │ ├── Advanced-Select │ │ └── The PADS.sql │ ├── Aggregation │ │ ├── Average Population.sql │ │ ├── Japan Population.sql │ │ ├── Population Density Difference.sql │ │ ├── Revising Aggregations - Averages.sql │ │ ├── Revising Aggregations - The Count Function.sql │ │ └── Revising Aggregations - The Sum Function.sql │ └── Basic-Select │ │ ├── Employee Names.sql │ │ ├── Employee Salaries.sql │ │ ├── Higher Than 75 Marks.sql │ │ ├── Japanese Cities' Detail.sql │ │ ├── Japanese Cities' Name.sql │ │ ├── Revising the Select Query - 1.sql │ │ ├── Revising the Select Query - 2.sql │ │ ├── Select All.sql │ │ ├── Select by ID.sql │ │ ├── Weather Observation Station 1.sql │ │ ├── Weather Observation Station 10.sql │ │ ├── Weather Observation Station 11.sql │ │ ├── Weather Observation Station 12.sql │ │ ├── Weather Observation Station 3.sql │ │ ├── Weather Observation Station 4.sql │ │ ├── Weather Observation Station 5.sql │ │ ├── Weather Observation Station 6.sql │ │ ├── Weather Observation Station 7.sql │ │ ├── Weather Observation Station 8.sql │ │ └── Weather Observation Station 9.sql └── Tutorials │ ├── 10 Days of Javascript │ ├── Day 0: Data Types.js │ ├── Day 0: Hello, World!.js │ ├── Day 1: Arithmetic Operators.js │ ├── Day 1: Functions.js │ ├── Day 1: Let and Const.js │ ├── Day 2: Conditional Statements: If-Else.js │ ├── Day 2: Conditional Statements: Switch.js │ ├── Day 2: Loops.js │ ├── Day 3: Arrays.js │ └── Day 3: Try, Catch, and Finally.js │ ├── 10 Days of Statistics │ ├── Day 0: Mean, Median, and Mode.py │ ├── Day 0: Weighted Mean.py │ ├── Day 1: Interquartile Range.py │ ├── Day 1: Quartiles.py │ ├── Day 1: Standard Deviation.py │ ├── Day 4: Binomial Distribution I.py │ ├── Day 4: Binomial Distribution II.py │ ├── Day 4: Geometric Distribution I.py │ ├── Day 4: Geometric Distribution II.py │ └── Day 5: Poisson Distribution I.py │ ├── 30-Days-of-Code │ ├── Day 0: Hello, World.go │ ├── Day 10: Binary Numbers.go │ ├── Day 11: 2D Arrays.go │ ├── Day 12: Inheritance.py │ ├── Day 13: Abstract Classes.py │ ├── Day 14: Scope.py │ ├── Day 15: Linked List.py │ ├── Day 16: Exceptions - String to Integer.py │ ├── Day 17: More Exceptions.py │ ├── Day 18: Queues and Stacks.cc │ ├── Day 19: Interfaces.cc │ ├── Day 1: Data Types.go │ ├── Day 20: Sorting.go │ ├── Day 21: Generics.cs │ ├── Day 22: Binary Search Trees.cc │ ├── Day 23: BST Level-Order Traversal.cc │ ├── Day 24: More Linked Lists.cc │ ├── Day 25: Running Time and Complexity.go │ ├── Day 26: Nested Logic.go │ ├── Day 27: Testing.go │ ├── Day 28: RegEx, Patterns, and Intro to Databases.go │ ├── Day 29: Bitwise AND.go │ ├── Day 2: Operators.go │ ├── Day 3: Intro to Conditional Statements.go │ ├── Day 4: Class vs. Instance.go │ ├── Day 5: Loops.go │ ├── Day 6: Let's Review.go │ ├── Day 7: Arrays.go │ ├── Day 8: Dictionaries and Maps.go │ └── Day 9: Recursion.go │ └── Cracking the Coding Interview │ ├── Bit Manipulation: Lonely Integer.fs │ ├── Recursion: Davis' Staircase.py │ ├── Recursion: Fibonacci Numbers.cs │ ├── Sorting: Bubble Sort.go │ └── Time Complexity: Primality.fs ├── InterviewBit └── Unique Binary Search Trees.cc ├── Jisuanke ├── A1227-UCloud 机房的网络搭建.py ├── A1231-微软手机的信号显示.py ├── A1232-微软大楼设计方案(简单).cc ├── A1233-微软大楼设计方案(中等).cc ├── A1242-Windows 画图.cc ├── A1244-百度地图导航.cc ├── A1246-腾讯消消乐.cc ├── A1649-危险路径.cc ├── T2230-蒜头套盒子.cc ├── T2231-蒜头套圈圈.cc ├── T2233-Wish.cc ├── T2234-造炸弹.cc ├── T2422-宠物收养所.cc ├── T3406-生活在树上(困难).cc ├── T3407-生活在树上(简单).cc ├── T3408-回文串.cc ├── T3413-生活在树上(中等).cc ├── T3585-Drought.cc ├── T48498-签到啦.py ├── T48499-石子游戏(简单).cc ├── T48500-石子游戏(中等).cc ├── T49108-格子.cc ├── T49111-攀登山峰.cc ├── T49112-斯摩棱斯克.cc ├── T49113-蒜头君的序列.py ├── T54137-wy的幸运数.cc ├── T54138-wy的单机游戏.cc ├── T54179-wy的石子游戏.cc ├── T54180-wy的玩具规划.cc ├── T59333-Herdle.cc └── T59334-Non-Transitive Dice.cc ├── Jobdu ├── 1057.cc ├── 1190.cc ├── 1508.cc └── 1518.cc ├── LICENSE ├── Leetcode ├── Algorithm │ ├── c# │ │ └── 00330-Patching Array.cs │ ├── cpp │ │ ├── 00001-Two Sum.cc │ │ ├── 00002-Add Two Numbers.cc │ │ ├── 00003-Longest Substring Without Repeating Characters.cc │ │ ├── 00004-Median of Two Sorted Arrays.cc │ │ ├── 00005-Longest Palindromic Substring.cc │ │ ├── 00006-ZigZag Conversion.cc │ │ ├── 00007-Reverse Integer.cc │ │ ├── 00008-String to Integer (atoi).cc │ │ ├── 00009-Palindrome Number.cc │ │ ├── 00010-Regular Expression Matching.cc │ │ ├── 00011-Container With Most Water.cc │ │ ├── 00012-Integer to Roman.cc │ │ ├── 00013-Roman to Integer.cc │ │ ├── 00014-Longest Common Prefix.cc │ │ ├── 00015-3Sum.cc │ │ ├── 00016-3Sum Closest.cc │ │ ├── 00017-Letter Combinations of a Phone Number.cc │ │ ├── 00018-4Sum.cc │ │ ├── 00019-Remove Nth Node From End of List.cc │ │ ├── 00020-Valid Parentheses.cc │ │ ├── 00021-Merge Two Sorted Lists.cc │ │ ├── 00022-Generate Parentheses.cc │ │ ├── 00023-Merge k Sorted Lists.cc │ │ ├── 00024-Swap Nodes in Pairs.cc │ │ ├── 00025-Reverse Nodes in k-Group.cc │ │ ├── 00026-Remove Duplicates from Sorted Array.cc │ │ ├── 00027-Remove Element.cc │ │ ├── 00029-Divide Two Integers.cc │ │ ├── 00030-Substring with Concatenation of All Words.cc │ │ ├── 00031-Next Permutation.cc │ │ ├── 00032-Longest Valid Parentheses.cc │ │ ├── 00033-Search in Rotated Sorted Array.cc │ │ ├── 00035-Search Insert Position.cc │ │ ├── 00036-Valid Sudoku.cc │ │ ├── 00037-Sudoku Solver.cc │ │ ├── 00038-Count and Say.cc │ │ ├── 00039-Combination Sum.cc │ │ ├── 00040-Combination Sum II.cc │ │ ├── 00041-First Missing Positive.cc │ │ ├── 00042-Trapping Rain Water.cc │ │ ├── 00043-Multiply Strings.cc │ │ ├── 00044-Wildcard Matching.cc │ │ ├── 00045-Jump Game II.cc │ │ ├── 00046-Permutations.cc │ │ ├── 00047-Permutations II.cc │ │ ├── 00048-Rotate Image.cc │ │ ├── 00050-Pow(x, n).cc │ │ ├── 00052-N-Queens II.cc │ │ ├── 00053-Maximum Subarray.cc │ │ ├── 00054-Spiral Matrix.cc │ │ ├── 00055-Jump Game.cc │ │ ├── 00056-Merge Intervals.cc │ │ ├── 00057-Insert Interval.cc │ │ ├── 00058-Length of Last Word.cc │ │ ├── 00059-Spiral Matrix II.cc │ │ ├── 00060-Permutation Sequence.cc │ │ ├── 00061-Rotate List.cc │ │ ├── 00062-Unique Paths.cc │ │ ├── 00063-Unique Paths II.cc │ │ ├── 00064-Minimum Path Sum.cc │ │ ├── 00065-Valid Number.cc │ │ ├── 00066-Plus One.cc │ │ ├── 00067-Add Binary.cc │ │ ├── 00068-Text Justification.cc │ │ ├── 00069-Sqrt(x).cc │ │ ├── 00070-Climbing Stairs.cc │ │ ├── 00071-Simplify Path.cc │ │ ├── 00072-Edit Distance.cc │ │ ├── 00073-Set Matrix Zeroes.cc │ │ ├── 00074-Search a 2D Matrix.cc │ │ ├── 00075-Sort Colors.cc │ │ ├── 00076-Minimum Window Substring.cc │ │ ├── 00077-Combinations.cc │ │ ├── 00078-Subsets.cc │ │ ├── 00079-Word Search.cc │ │ ├── 00080-Remove Duplicates from Sorted Array II.cc │ │ ├── 00083-Remove Duplicates from Sorted List.cc │ │ ├── 00084-Largest Rectangle in Histogram.cc │ │ ├── 00085-Maximal Rectangle.cc │ │ ├── 00086-Partition List.cc │ │ ├── 00087-Scramble String.cc │ │ ├── 00088-Merge Sorted Array.cc │ │ ├── 00089-Gray Code.cc │ │ ├── 00090-Subsets II.cc │ │ ├── 00091-Decode Ways.cc │ │ ├── 00092-Reverse Linked List II.cc │ │ ├── 00093-Restore IP Addresses.cc │ │ ├── 00094-Binary Tree Inorder Traversal.cc │ │ ├── 00095-Unique Binary Search Trees II.cc │ │ ├── 00096-Unique Binary Search Trees.cc │ │ ├── 00097-Interleaving String.cc │ │ ├── 00098-Validate Binary Search Tree.cc │ │ ├── 00099-Recover Binary Search Tree.cc │ │ ├── 00100-Same Tree.cc │ │ ├── 00101-Symmetric Tree.cc │ │ ├── 00102-Binary Tree Level Order Traversal.cc │ │ ├── 00103-Binary Tree Zigzag Level Order Traversal.cc │ │ ├── 00104-Maximum Depth of Binary Tree.cc │ │ ├── 00105-Construct Binary Tree from Preorder and Inorder Traversal.cc │ │ ├── 00106-Construct Binary Tree from Inorder and Postorder Traversal.cc │ │ ├── 00107-Binary Tree Level Order Traversal II.cc │ │ ├── 00108-Convert Sorted Array to Binary Search Tree.cc │ │ ├── 00109-Convert Sorted List to Binary Search Tree.cc │ │ ├── 00110-Balanced Binary Tree.cc │ │ ├── 00111-Minimum Depth of Binary Tree.cc │ │ ├── 00112-Path Sum.cc │ │ ├── 00113-Path Sum II.cc │ │ ├── 00114-Flatten Binary Tree to Linked List.cc │ │ ├── 00115-Distinct Subsequences.cc │ │ ├── 00116-Populating Next Right Pointers in Each Node.cc │ │ ├── 00117-Populating Next Right Pointers in Each Node II.cc │ │ ├── 00118-Pascal's Triangle.cc │ │ ├── 00119-Pascal's Triangle II.cc │ │ ├── 00120-Triangle.cc │ │ ├── 00121-Best Time to Buy and Sell Stock.cc │ │ ├── 00122-Best Time to Buy and Sell Stock II.cc │ │ ├── 00123-Best Time to Buy and Sell Stock III.cc │ │ ├── 00124-Binary Tree Maximum Path Sum.cc │ │ ├── 00125-Valid Palindrome.cc │ │ ├── 00126-Word Ladder II.cc │ │ ├── 00127-Word Ladder.cc │ │ ├── 00128-Longest Consecutive Sequence.cc │ │ ├── 00129-Sum Root to Leaf Numbers.cc │ │ ├── 00130-Surrounded Regions.cc │ │ ├── 00131-Palindrome Partitioning.cc │ │ ├── 00132-Palindrome Partitioning II.cc │ │ ├── 00133-Clone Graph.cc │ │ ├── 00135-Candy.cc │ │ ├── 00136-Single Number.cc │ │ ├── 00137-Single Number II.cc │ │ ├── 00138-Copy List with Random Pointer.cc │ │ ├── 00139-Word Break.cc │ │ ├── 00140-Word Break II.cc │ │ ├── 00141-Linked List Cycle.cc │ │ ├── 00142-Linked List Cycle II.cc │ │ ├── 00143-Reorder List.cc │ │ ├── 00144-Binary Tree Preorder Traversal.cc │ │ ├── 00145-Binary Tree Postorder Traversal.cc │ │ ├── 00146-LRU Cache.cc │ │ ├── 00147-Insertion Sort List.cc │ │ ├── 00148-Sort List.cc │ │ ├── 00149-Max Points on a Line.cc │ │ ├── 00150-Evaluate Reverse Polish Notation.cc │ │ ├── 00151-Reverse Words in a String.cc │ │ ├── 00152-Maximum Product Subarray.cc │ │ ├── 00153-Find Minimum in Rotated Sorted Array.cc │ │ ├── 00154-Find Minimum in Rotated Sorted Array II.cc │ │ ├── 00156-Binary Tree Upside Down.cc │ │ ├── 00157-Read N Characters Given Read4.cc │ │ ├── 00158-Read N Characters Given Read4 II - Call multiple times.cc │ │ ├── 00159-Longest Substring with At Most Two Distinct Characters.cc │ │ ├── 00160-Intersection of Two Linked Lists.cc │ │ ├── 00161-One Edit Distance.cc │ │ ├── 00162-Find Peak Element.cc │ │ ├── 00163-Missing Ranges.cc │ │ ├── 00164-Maximum Gap.cc │ │ ├── 00166-Fraction to Recurring Decimal.cc │ │ ├── 00167-Two Sum II - Input array is sorted.cc │ │ ├── 00168-Excel Sheet Column Title.cc │ │ ├── 00169-Majority Element.cc │ │ ├── 00170-Two Sum III - Data structure design.cc │ │ ├── 00171-Excel Sheet Column Number.cc │ │ ├── 00172-Factorial Trailing Zeroes.cc │ │ ├── 00174-Dungeon Game.cc │ │ ├── 00179-Largest Number.cc │ │ ├── 00186-Reverse Words in a String II.cc │ │ ├── 00187-Repeated DNA Sequences.cc │ │ ├── 00188-Best Time to Buy and Sell Stock IV.cc │ │ ├── 00189-Rotate Array.cc │ │ ├── 00190-Reverse Bits.cc │ │ ├── 00191-Number of 1 Bits.cc │ │ ├── 00198-House Robber.cc │ │ ├── 00199-Binary Tree Right Side View.cc │ │ ├── 00200-Number of Islands.cc │ │ ├── 00201-Bitwise AND of Numbers Range.cc │ │ ├── 00203-Remove Linked List Elements.cc │ │ ├── 00204-Count Primes.cc │ │ ├── 00205-Isomorphic Strings.cc │ │ ├── 00206-Reverse Linked List.cc │ │ ├── 00207-Course Schedule.cc │ │ ├── 00208-Implement Trie (Prefix Tree).cc │ │ ├── 00209-Minimum Size Subarray Sum.cc │ │ ├── 00210-Course Schedule II.cc │ │ ├── 00211-Design Add and Search Words Data Structure.cc │ │ ├── 00212-Word Search II.cc │ │ ├── 00213-House Robber II.cc │ │ ├── 00214-Shortest Palindrome.cc │ │ ├── 00215-Kth Largest Element in an Array.cc │ │ ├── 00216-Combination Sum III.cc │ │ ├── 00217-Contains Duplicate.cc │ │ ├── 00218-The Skyline Problem.cc │ │ ├── 00219-Contains Duplicate II.cc │ │ ├── 00220-Contains Duplicate III.cc │ │ ├── 00221-Maximal Square.cc │ │ ├── 00222-Count Complete Tree Nodes.cc │ │ ├── 00223-Rectangle Area.cc │ │ ├── 00225-Implement Stack using Queues.cc │ │ ├── 00226-Invert Binary Tree.cc │ │ ├── 00228-Summary Ranges.cc │ │ ├── 00229-Majority Element II.cc │ │ ├── 00230-Kth Smallest Element in a BST.cc │ │ ├── 00231-Power of Two.cc │ │ ├── 00232-Implement Queue using Stacks.cc │ │ ├── 00234-Palindrome Linked List.cc │ │ ├── 00235-Lowest Common Ancestor of a Binary Search Tree.cc │ │ ├── 00236-Lowest Common Ancestor of a Binary Tree.cc │ │ ├── 00237-Delete Node in a Linked List.cc │ │ ├── 00238-Product of Array Except Self.cc │ │ ├── 00239-Sliding Window Maximum.cc │ │ ├── 00240-Search a 2D Matrix II.cc │ │ ├── 00243-Shortest Word Distance.cc │ │ ├── 00244-Shortest Word Distance II.cc │ │ ├── 00245-Shortest Word Distance III.cc │ │ ├── 00249-Group Shifted Strings.cc │ │ ├── 00250-Count Univalue Subtrees.cc │ │ ├── 00253-Meeting Rooms II.cc │ │ ├── 00257-Binary Tree Paths.cc │ │ ├── 00258-Add Digits.cc │ │ ├── 00260-Single Number III.cc │ │ ├── 00263-Ugly Number.cc │ │ ├── 00264-Ugly Number II.cc │ │ ├── 00265-Paint House II.cc │ │ ├── 00268-Missing Number.cc │ │ ├── 00269-Alien Dictionary.cc │ │ ├── 00270-Closest Binary Search Tree Value.cc │ │ ├── 00274-H-Index.cc │ │ ├── 00275-H-Index II.cc │ │ ├── 00277-Find the Celebrity.cc │ │ ├── 00278-First Bad Version.cc │ │ ├── 00279-Perfect Squares.cc │ │ ├── 00282-Expression Add Operators.cc │ │ ├── 00283-Move Zeroes.cc │ │ ├── 00284-Peeking Iterator.cc │ │ ├── 00286-Walls and Gates.cc │ │ ├── 00287-Find the Duplicate Number.cc │ │ ├── 00289-Game of Life.cc │ │ ├── 00292-Nim Game.cc │ │ ├── 00295-Find Median from Data Stream.cc │ │ ├── 00296-Best Meeting Point.cc │ │ ├── 00299-Bulls and Cows.cc │ │ ├── 00300-Longest Increasing Subsequence.cc │ │ ├── 00301-Remove Invalid Parentheses.cc │ │ ├── 00303-Range Sum Query - Immutable.cc │ │ ├── 00304-Range Sum Query 2D - Immutable.cc │ │ ├── 00306-Additive Number.cc │ │ ├── 00307-Range Sum Query - Mutable.cc │ │ ├── 00308-Range Sum Query 2D - Mutable.cc │ │ ├── 00310-Minimum Height Trees.cc │ │ ├── 00312-Burst Balloons.cc │ │ ├── 00313-Super Ugly Number.cc │ │ ├── 00315-Count of Smaller Numbers After Self.cc │ │ ├── 00318-Maximum Product of Word Lengths.cc │ │ ├── 00319-Bulb Switcher.cc │ │ ├── 00321-Create Maximum Number.cc │ │ ├── 00322-Coin Change.cc │ │ ├── 00324-Wiggle Sort II.cc │ │ ├── 00327-Count of Range Sum.cc │ │ ├── 00328-Odd Even Linked List.cc │ │ ├── 00329-Longest Increasing Path in a Matrix.cc │ │ ├── 00331-Verify Preorder Serialization of a Binary Tree.cc │ │ ├── 00332-Reconstruct Itinerary.cc │ │ ├── 00334-Increasing Triplet Subsequence.cc │ │ ├── 00336-Palindrome Pairs.cc │ │ ├── 00337-House Robber III.cc │ │ ├── 00342-Power of Four.cc │ │ ├── 00344-Reverse String.cc │ │ ├── 00345-Reverse Vowels of a String.cpp │ │ ├── 00350-Intersection of Two Arrays II.cc │ │ ├── 00352-Data Stream as Disjoint Intervals.cc │ │ ├── 00353-Design Snake Game.cc │ │ ├── 00354-Russian Doll Envelopes.cc │ │ ├── 00359-Logger Rate Limiter.cc │ │ ├── 00360-Sort Transformed Array.cc │ │ ├── 00361-Bomb Enemy.cc │ │ ├── 00362-Design Hit Counter.cc │ │ ├── 00363-Max Sum of Rectangle No Larger Than K.cc │ │ ├── 00365-Water and Jug Problem.cc │ │ ├── 00367-Valid Perfect Square.cc │ │ ├── 00371-Sum of Two Integers.cc │ │ ├── 00373-Find K Pairs with Smallest Sums.cc │ │ ├── 00375-Guess Number Higher or Lower II.cc │ │ ├── 00377-Combination Sum IV.cc │ │ ├── 00380-Insert Delete GetRandom O(1).cc │ │ ├── 00381-Insert Delete GetRandom O(1) - Duplicates allowed.cc │ │ ├── 00382-Linked List Random Node.cc │ │ ├── 00386-Lexicographical Numbers.cc │ │ ├── 00389-Find the Difference.cc │ │ ├── 00397-Integer Replacement.cc │ │ ├── 00399-Evaluate Division.cc │ │ ├── 00403-Frog Jump.cc │ │ ├── 00405-Convert a Number to Hexadecimal.cc │ │ ├── 00410-Split Array Largest Sum.cc │ │ ├── 00413-Arithmetic Slices.cc │ │ ├── 00414-Third Maximum Number.cc │ │ ├── 00415-Add Strings.cc │ │ ├── 00416-Partition Equal Subset Sum.cc │ │ ├── 00417-Pacific Atlantic Water Flow.cc │ │ ├── 00424-Longest Repeating Character Replacement.cc │ │ ├── 00425-Word Squares.cc │ │ ├── 00432-All O`one Data Structure.cc │ │ ├── 00435-Non-overlapping Intervals.cc │ │ ├── 00436-Find Right Interval.cc │ │ ├── 00437-Path Sum III.cc │ │ ├── 00438-Find All Anagrams in a String.cc │ │ ├── 00441-Arranging Coins.cc │ │ ├── 00442-Find All Duplicates in an Array.cc │ │ ├── 00443-String Compression.cc │ │ ├── 00444-Sequence Reconstruction.cc │ │ ├── 00445-Add Two Numbers II.cc │ │ ├── 00446-Arithmetic Slices II - Subsequence.cc │ │ ├── 00447-Number of Boomerangs.cc │ │ ├── 00448-Find All Numbers Disappeared in an Array.cc │ │ ├── 00449-Serialize and Deserialize BST.cc │ │ ├── 00450-Delete Node in a BST.cc │ │ ├── 00451-Sort Characters By Frequency.cc │ │ ├── 00452-Minimum Number of Arrows to Burst Balloons.cc │ │ ├── 00454-4Sum II.cc │ │ ├── 00455-Assign Cookies.cc │ │ ├── 00456-132 Pattern.cc │ │ ├── 00459-Repeated Substring Pattern.cc │ │ ├── 00460-LFU Cache.cc │ │ ├── 00462-Minimum Moves to Equal Array Elements II.cc │ │ ├── 00463-Island Perimeter.cc │ │ ├── 00464-Can I Win.cc │ │ ├── 00467-Unique Substrings in Wraparound String.cc │ │ ├── 00472-Concatenated Words.cc │ │ ├── 00473-Matchsticks to Square.cc │ │ ├── 00474-Ones and Zeroes.cc │ │ ├── 00475-Heaters.cc │ │ ├── 00477-Total Hamming Distance.cc │ │ ├── 00480-Sliding Window Median.cc │ │ ├── 00491-Increasing Subsequences.cc │ │ ├── 00493-Reverse Pairs.cc │ │ ├── 00494-Target Sum.cc │ │ ├── 00496-Next Greater Element I.cc │ │ ├── 00501-Find Mode in Binary Search Tree.cc │ │ ├── 00502-IPO.cc │ │ ├── 00503-Next Greater Element II.cc │ │ ├── 00514-Freedom Trail.cc │ │ ├── 00516-Longest Palindromic Subsequence.cc │ │ ├── 00524-Longest Word in Dictionary through Deleting.cc │ │ ├── 00526-Beautiful Arrangement.cc │ │ ├── 00529-Minesweeper.cc │ │ ├── 00530-Minimum Absolute Difference in BST.cc │ │ ├── 00540-Single Element in a Sorted Array.cc │ │ ├── 00542-01 Matrix.cc │ │ ├── 00546-Remove Boxes.cc │ │ ├── 00552-Student Attendance Record II.cc │ │ ├── 00553-Optimal Division.cc │ │ ├── 00554-Brick Wall.cc │ │ ├── 00555-Split Concatenated Strings.cc │ │ ├── 00565-Array Nesting.cc │ │ ├── 00568-Maximum Vacation Days.cc │ │ ├── 00572-Subtree of Another Tree.cc │ │ ├── 00573-Squirrel Simulation.cc │ │ ├── 00576-Out of Boundary Paths.cc │ │ ├── 00583-Delete Operation for Two Strings.cc │ │ ├── 00587-Erect the Fence.cc │ │ ├── 00600-Non-negative Integers without Consecutive Ones.cc │ │ ├── 00617-Merge Two Binary Trees.cc │ │ ├── 00621-Task Scheduler.cc │ │ ├── 00623-Add One Row to Tree.cc │ │ ├── 00624-Maximum Distance in Arrays.cc │ │ ├── 00625-Minimum Factorization.cc │ │ ├── 00629-K Inverse Pairs Array.cc │ │ ├── 00630-Course Schedule III.cc │ │ ├── 00633-Sum of Square Numbers.cc │ │ ├── 00634-Find the Derangement of An Array.cc │ │ ├── 00636-Exclusive Time of Functions.cc │ │ ├── 00637-Average of Levels in Binary Tree.cc │ │ ├── 00638-Shopping Offers.cc │ │ ├── 00639-Decode Ways II.cc │ │ ├── 00642-Design Search Autocomplete System.cc │ │ ├── 00644-Maximum Average Subarray II.cc │ │ ├── 00645-Set Mismatch.cc │ │ ├── 00646-Maximum Length of Pair Chain.cc │ │ ├── 00647-Palindromic Substrings.cc │ │ ├── 00650-2 Keys Keyboard.cc │ │ ├── 00651-4 Keys Keyboard.cc │ │ ├── 00652-Find Duplicate Subtrees.cc │ │ ├── 00653-Two Sum IV - Input is a BST.cc │ │ ├── 00654-Maximum Binary Tree.cc │ │ ├── 00655-Print Binary Tree.cc │ │ ├── 00656-Coin Path.cc │ │ ├── 00661-Image Smoother.cc │ │ ├── 00664-Strange Printer.cc │ │ ├── 00669-Trim a Binary Search Tree.cc │ │ ├── 00671-Second Minimum Node In a Binary Tree.cc │ │ ├── 00675-Cut Off Trees for Golf Event.cc │ │ ├── 00683-K Empty Slots.cc │ │ ├── 00684-Redundant Connection.cc │ │ ├── 00685-Redundant Connection II.cc │ │ ├── 00691-Stickers to Spell Word.cc │ │ ├── 00695-Max Area of Island.cc │ │ ├── 00698-Partition to K Equal Sum Subsets.cc │ │ ├── 00703-Kth Largest Element in a Stream.cc │ │ ├── 00710-Random Pick with Blacklist.cc │ │ ├── 00712-Minimum ASCII Delete Sum for Two Strings.cc │ │ ├── 00713-Subarray Product Less Than K.cc │ │ ├── 00715-Range Module.cc │ │ ├── 00716-Max Stack.cc │ │ ├── 00717-1-bit and 2-bit Characters.cc │ │ ├── 00719-Find K-th Smallest Pair Distance.cc │ │ ├── 00720-Longest Word in Dictionary.cc │ │ ├── 00727-Minimum Window Subsequence.cc │ │ ├── 00731-My Calendar II.cc │ │ ├── 00732-My Calendar III.cc │ │ ├── 00737-Sentence Similarity II.cc │ │ ├── 00739-Daily Temperatures.cc │ │ ├── 00741-Cherry Pickup.cc │ │ ├── 00743-Network Delay Time.cc │ │ ├── 00750-Number Of Corner Rectangles.cc │ │ ├── 00752-Open the Lock.cc │ │ ├── 00753-Cracking the Safe.cc │ │ ├── 00755-Pour Water.cc │ │ ├── 00757-Set Intersection Size At Least Two.cc │ │ ├── 00759-Employee Free Time.cc │ │ ├── 00764-Largest Plus Sign.cc │ │ ├── 00765-Couples Holding Hands.cc │ │ ├── 00766-Toeplitz Matrix.cc │ │ ├── 00769-Max Chunks To Make Sorted.cc │ │ ├── 00773-Sliding Puzzle.cc │ │ ├── 00775-Global and Local Inversions.cc │ │ ├── 00776-Split BST.cc │ │ ├── 00777-Swap Adjacent in LR String.cc │ │ ├── 00778-Swim in Rising Water.cc │ │ ├── 00779-K-th Symbol in Grammar.cc │ │ ├── 00783-Minimum Distance Between BST Nodes.cc │ │ ├── 00786-K-th Smallest Prime Fraction.cc │ │ ├── 00787-Cheapest Flights Within K Stops.cc │ │ ├── 00790-Domino and Tromino Tiling.cc │ │ ├── 00795-Number of Subarrays with Bounded Maximum.cc │ │ ├── 00797-All Paths From Source to Target.cc │ │ ├── 00803-Bricks Falling When Hit.cc │ │ ├── 00813-Largest Sum of Averages.cc │ │ ├── 00815-Bus Routes.cc │ │ ├── 00827-Making A Large Island.cc │ │ ├── 00839-Similar String Groups.cc │ │ ├── 00840-Magic Squares In Grid.cc │ │ ├── 00842-Split Array into Fibonacci Sequence.cc │ │ ├── 00848-Shifting Letters.cc │ │ ├── 00849-Maximize Distance to Closest Person.cc │ │ ├── 00851-Loud and Rich.cc │ │ ├── 00854-K-Similar Strings.cc │ │ ├── 00855-Exam Room.cc │ │ ├── 00861-Score After Flipping Matrix.cc │ │ ├── 00862-Shortest Subarray with Sum at Least K.cc │ │ ├── 00863-All Nodes Distance K in Binary Tree.cc │ │ ├── 00865-Smallest Subtree with all the Deepest Nodes.cc │ │ ├── 00873-Length of Longest Fibonacci Subsequence.cc │ │ ├── 00874-Walking Robot Simulation.cc │ │ ├── 00879-Profitable Schemes.cc │ │ ├── 00881-Boats to Save People.cc │ │ ├── 00882-Reachable Nodes In Subdivided Graph.cc │ │ ├── 00886-Possible Bipartition.cc │ │ ├── 00895-Maximum Frequency Stack.cc │ │ ├── 00900-RLE Iterator.cc │ │ ├── 00901-Online Stock Span.cc │ │ ├── 00903-Valid Permutations for DI Sequence.cc │ │ ├── 00907-Sum of Subarray Minimums.cc │ │ ├── 00915-Partition Array into Disjoint Intervals.cc │ │ ├── 00923-3Sum With Multiplicity.cc │ │ ├── 00924-Minimize Malware Spread.cc │ │ ├── 00938-Range Sum of BST.cc │ │ ├── 00947-Most Stones Removed with Same Row or Column.cc │ │ ├── 00970-Powerful Integers.cc │ │ ├── 00975-Odd Even Jump.cc │ │ ├── 00981-Time Based Key-Value Store.cpp │ │ ├── 00996-Number of Squareful Arrays.cc │ │ ├── 01014-Best Sightseeing Pair.cc │ │ ├── 01031-Maximum Sum of Two Non-Overlapping Subarrays.cc │ │ ├── 01032-Stream of Characters.cc │ │ ├── 01046-Last Stone Weight.cc │ │ ├── 01049-Last Stone Weight II.cc │ │ ├── 01124-Longest Well-Performing Interval.cc │ │ ├── 01129-Shortest Path with Alternating Colors.cc │ │ ├── 01147-Longest Chunked Palindrome Decomposition.cc │ │ ├── 01162-As Far from Land as Possible.cc │ │ ├── 01178-Number of Valid Words for Each Puzzle.cc │ │ ├── 01191-K-Concatenation Maximum Sum.cc │ │ ├── 01223-Dice Roll Simulation.cc │ │ ├── 01224-Maximum Equal Frequency.cc │ │ ├── 01237-Find Positive Integer Solution for a Given Equation.cc │ │ ├── 01240-Tiling a Rectangle with the Fewest Squares.cc │ │ ├── 01296-Divide Array in Sets of K Consecutive Numbers.cc │ │ ├── 01353-Maximum Number of Events That Can Be Attended.cc │ │ ├── 01354-Construct Target Array With Multiple Sums.cc │ │ ├── 01383-Maximum Performance of a Team.cc │ │ ├── 01389-Create Target Array in the Given Order.cc │ │ ├── 01409-Queries on a Permutation With Key.cc │ │ ├── 01433-Check If a String Can Break Another String.cc │ │ ├── 01439-Find the Kth Smallest Sum of a Matrix With Sorted Rows.cc │ │ ├── 01478-Allocate Mailboxes.cc │ │ ├── 01488-Avoid Flood in The City.cc │ │ ├── 01494-Parallel Courses II.cc │ │ ├── 01508-Range Sum of Sorted Subarray Sums.cc │ │ ├── 01531-String Compression II.cc │ │ ├── 01562-Find Latest Group of Size M.cc │ │ ├── 01563-Stone Game V.cc │ │ ├── 01606-Find Servers That Handled Most Number of Requests.cc │ │ ├── 01642-Furthest Building You Can Reach.cc │ │ ├── 01671-Minimum Number of Removals to Make Mountain Array.cc │ │ ├── 01765-Map of Highest Peak.cc │ │ ├── 01834-Single-Threaded CPU.cc │ │ ├── 01909-Remove One Element to Make the Array Strictly Increasing.cc │ │ ├── 01928-Minimum Cost to Reach Destination in Time.cc │ │ ├── 01938-Maximum Genetic Difference Query.cc │ │ ├── 01942-The Number of the Smallest Unoccupied Chair.cc │ │ ├── 01976-Number of Ways to Arrive at Destination.cc │ │ ├── 01986-Minimum Number of Work Sessions to Finish the Tasks.cc │ │ ├── 01987-Number of Unique Good Subsequences.cc │ │ ├── 01995-Count Special Quadruplets.py │ │ ├── 01996-The Number of Weak Characters in the Game.py │ │ ├── 02071-Maximum Number of Tasks You Can Assign.cc │ │ ├── 02163-Minimum Difference in Sums After Removal of Elements.cc │ │ ├── 02172-Maximum AND Sum of Array.cc │ │ ├── 02213-Longest Substring of One Repeating Character.py │ │ ├── 02233-Maximum Product After K Increments.cc │ │ ├── 02249-Count Lattice Points Inside a Circle.py │ │ ├── 02271-Maximum White Tiles Covered by a Carpet.cc │ │ ├── 02276-Count Integers in Intervals.cc │ │ ├── 02286-Booking Concert Tickets in Groups.cc │ │ ├── 02290-Minimum Obstacle Removal to Reach Corner.py │ │ ├── 02296-Design a Text Editor.cc │ │ ├── 02349-Design a Number Container System.cc │ │ ├── 02353-Design a Food Rating System.cc │ │ ├── 02360-Longest Cycle in a Graph.cc │ │ ├── 02382-Maximum Segment Sum After Removals.cc │ │ ├── 02386-Find the K-Sum of an Array.cc │ │ ├── 02462-Total Cost to Hire K Workers.cc │ │ ├── 02542-Maximum Subsequence Score.cc │ │ ├── 02551-Put Marbles in Bags.cc │ │ ├── 02589-Minimum Time to Complete All Tasks.cc │ │ ├── 02602-Minimum Operations to Make All Array Elements Equal.cc │ │ ├── 02608-Shortest Cycle in a Graph.cc │ │ ├── 02612-Minimum Reverse Operations.cc │ │ ├── 02616-Minimize the Maximum Difference of Pairs.cc │ │ ├── 02617-Minimum Number of Visited Cells in a Grid.cc │ │ ├── 02642-Design Graph With Shortest Path Calculator.cc │ │ ├── 02659-Make Array Empty.cc │ │ ├── 02672-Number of Adjacent Elements With the Same Color.cpp │ │ ├── 02736-Maximum Sum Queries.cc │ │ ├── 02741-Special Permutations.cc │ │ ├── 02905-Find Indices With Index and Value Difference II.cc │ │ ├── 03066-Minimum Operations to Exceed Threshold Value II.cc │ │ ├── 03080-Mark Elements on Array by Performing Queries.cc │ │ ├── 03092-Most Frequent IDs.cc │ │ ├── 03102-Minimize Manhattan Distances.cc │ │ ├── 03180-Maximum Total Reward Using Operations I.cc │ │ ├── 03181-Maximum Total Reward Using Operations II.cc │ │ ├── 03243-Shortest Distance After Road Addition Queries I.cc │ │ ├── 03244-Shortest Distance After Road Addition Queries II.cc │ │ ├── 03275-K-th Nearest Obstacle Queries.cc │ │ ├── 03454-Separate Squares II.cc │ │ ├── 03478-Choose K Elements With Maximum Sum.cc │ │ ├── 03479-Fruits Into Baskets III.cc │ │ ├── 03485-Longest Common Prefix of K Strings After Removal.cc │ │ ├── 03494-Find the Minimum Amount of Time to Brew Potions.cc │ │ ├── 03495-Minimum Operations to Make Array Elements Zero.cc │ │ ├── 03500-Minimum Cost to Divide Array Into Subarrays.cc │ │ └── 03504-Longest Palindrome After Substring Concatenation II.cc │ ├── golang │ │ ├── 00054-Spiral Matrix.go │ │ ├── 00283-Move Zeroes.go │ │ ├── 00824-Goat Latin.go │ │ ├── 00825-Friends Of Appropriate Ages.go │ │ ├── 00829-Consecutive Numbers Sum.go │ │ ├── 00832-Flipping an Image.go │ │ ├── 00834-Sum of Distances in Tree.go │ │ ├── 00844-Backspace String Compare.go │ │ ├── 00867-Transpose Matrix.go │ │ └── 01037-Valid Boomerang.go │ ├── java │ │ ├── 00002-Add Two Numbers.java │ │ ├── 00003-Longest Substring Without Repeating Characters.java │ │ ├── 00026-Remove Duplicates from Sorted Array.java │ │ ├── 00041-First Missing Positive.java │ │ ├── 00042-Trapping Rain Water.java │ │ ├── 00045-Jump Game II.java │ │ ├── 00058-Length of Last Word.java │ │ ├── 00080-Remove Duplicates from Sorted Array II.java │ │ ├── 00084-Largest Rectangle in Histogram.java │ │ ├── 00085-Maximal Rectangle.java │ │ ├── 00094-Binary Tree Inorder Traversal.java │ │ ├── 00097-Interleaving String.java │ │ ├── 00114-Flatten Binary Tree to Linked List.java │ │ ├── 00117-Populating Next Right Pointers in Each Node II.java │ │ ├── 00121-Best Time to Buy and Sell Stock.java │ │ ├── 00124-Binary Tree Maximum Path Sum.java │ │ ├── 00134-Gas Station.java │ │ ├── 00135-Candy.java │ │ ├── 00144-Binary Tree Preorder Traversal.java │ │ ├── 00145-Binary Tree Postorder Traversal.java │ │ ├── 00155-Min Stack.java │ │ ├── 00162-Find Peak Element.java │ │ ├── 00198-House Robber.java │ │ └── 00303-Range Sum Query - Immutable.java │ ├── kotlin │ │ ├── 00001-Two Sum.kt │ │ ├── 00002-Add Two Numbers.kt │ │ ├── 00003-Longest Substring Without Repeating Characters.kt │ │ ├── 00050-Pow(x, n).kt │ │ └── 00053-Maximum Subarray.kt │ ├── python │ │ ├── 1000 │ │ │ ├── 01000-Minimum Cost to Merge Stones.py │ │ │ ├── 01001-Grid Illumination.py │ │ │ ├── 01002-Find Common Characters.py │ │ │ ├── 01003-Check If Word Is Valid After Substitutions.py │ │ │ ├── 01004-Max Consecutive Ones III.py │ │ │ ├── 01005-Maximize Sum Of Array After K Negations.py │ │ │ ├── 01006-Clumsy Factorial.py │ │ │ ├── 01007-Minimum Domino Rotations For Equal Row.py │ │ │ ├── 01008-Construct Binary Search Tree from Preorder Traversal.py │ │ │ ├── 01009-Complement of Base 10 Integer.py │ │ │ ├── 01010-Pairs of Songs With Total Durations Divisible by 60.py │ │ │ ├── 01011-Capacity To Ship Packages Within D Days.py │ │ │ ├── 01012-Numbers With Repeated Digits.py │ │ │ ├── 01013-Partition Array Into Three Parts With Equal Sum.py │ │ │ ├── 01015-Smallest Integer Divisible by K.py │ │ │ ├── 01016-Binary String With Substrings Representing 1 To N.py │ │ │ ├── 01017-Convert to Base -2.py │ │ │ ├── 01018-Binary Prefix Divisible By 5.py │ │ │ ├── 01019-Next Greater Node In Linked List.py │ │ │ ├── 01020-Number of Enclaves.py │ │ │ ├── 01021-Remove Outermost Parentheses.py │ │ │ ├── 01022-Sum of Root To Leaf Binary Numbers.py │ │ │ ├── 01023-Camelcase Matching.py │ │ │ ├── 01024-Video Stitching.py │ │ │ ├── 01025-Divisor Game.py │ │ │ ├── 01026-Maximum Difference Between Node and Ancestor.py │ │ │ ├── 01028-Recover a Tree From Preorder Traversal.py │ │ │ ├── 01029-Two City Scheduling.py │ │ │ ├── 01030-Matrix Cells in Distance Order.py │ │ │ ├── 01033-Moving Stones Until Consecutive.py │ │ │ ├── 01034-Coloring A Border.py │ │ │ ├── 01035-Uncrossed Lines.py │ │ │ ├── 01036-Escape a Large Maze.py │ │ │ ├── 01038-Binary Search Tree to Greater Sum Tree.py │ │ │ ├── 01039-Minimum Score Triangulation of Polygon.py │ │ │ ├── 01040-Moving Stones Until Consecutive II.py │ │ │ ├── 01041-Robot Bounded In Circle.py │ │ │ ├── 01042-Flower Planting With No Adjacent.py │ │ │ ├── 01043-Partition Array for Maximum Sum.py │ │ │ ├── 01044-Longest Duplicate Substring.py │ │ │ ├── 01047-Remove All Adjacent Duplicates In String.py │ │ │ ├── 01048-Longest String Chain.py │ │ │ ├── 01051-Height Checker.py │ │ │ ├── 01052-Grumpy Bookstore Owner.py │ │ │ ├── 01053-Previous Permutation With One Swap.py │ │ │ ├── 01054-Distant Barcodes.py │ │ │ ├── 01071-Greatest Common Divisor of Strings.py │ │ │ ├── 01072-Flip Columns For Maximum Number of Equal Rows.py │ │ │ ├── 01073-Adding Two Negabinary Numbers.py │ │ │ ├── 01074-Number of Submatrices That Sum to Target.py │ │ │ ├── 01078-Occurrences After Bigram.py │ │ │ ├── 01079-Letter Tile Possibilities.py │ │ │ ├── 01089-Duplicate Zeros.py │ │ │ ├── 01090-Largest Values From Labels.py │ │ │ ├── 01091-Shortest Path in Binary Matrix.py │ │ │ ├── 01092-Shortest Common Supersequence.py │ │ │ ├── 01094-Car Pooling.py │ │ │ ├── 01095-Find in Mountain Array.py │ │ │ ├── 01096-Brace Expansion II.py │ │ │ ├── 01103-Distribute Candies to People.py │ │ │ ├── 01104-Path In Zigzag Labelled Binary Tree.py │ │ │ ├── 01105-Filling Bookcase Shelves.py │ │ │ ├── 01106-Parsing A Boolean Expression.py │ │ │ ├── 01108-Defanging an IP Address.py │ │ │ ├── 01109-Corporate Flight Bookings.py │ │ │ ├── 01110-Delete Nodes And Return Forest.py │ │ │ ├── 01111-Maximum Nesting Depth of Two Valid Parentheses Strings.py │ │ │ ├── 01121-Divide Array Into Increasing Sequences.py │ │ │ ├── 01122-Relative Sort Array.py │ │ │ ├── 01123-Lowest Common Ancestor of Deepest Leaves.py │ │ │ ├── 01125-Smallest Sufficient Team.py │ │ │ ├── 01128-Number of Equivalent Domino Pairs.py │ │ │ ├── 01130-Minimum Cost Tree From Leaf Values.py │ │ │ ├── 01131-Maximum of Absolute Value Expression.py │ │ │ ├── 01137-N-th Tribonacci Number.py │ │ │ ├── 01138-Alphabet Board Path.py │ │ │ ├── 01139-Largest 1-Bordered Square.py │ │ │ ├── 01140-Stone Game II.py │ │ │ ├── 01143-Longest Common Subsequence.py │ │ │ ├── 01144-Decrease Elements To Make Array Zigzag.py │ │ │ ├── 01145-Binary Tree Coloring Game.py │ │ │ ├── 01146-Snapshot Array.py │ │ │ ├── 01154-Day of the Year.py │ │ │ ├── 01155-Number of Dice Rolls With Target Sum.py │ │ │ ├── 01156-Swap For Longest Repeated Character Substring.py │ │ │ ├── 01157-Online Majority Element In Subarray.py │ │ │ ├── 01160-Find Words That Can Be Formed by Characters.py │ │ │ ├── 01161-Maximum Level Sum of a Binary Tree.py │ │ │ ├── 01170-Compare Strings by Frequency of the Smallest Character.py │ │ │ ├── 01171-Remove Zero Sum Consecutive Nodes from Linked List.py │ │ │ ├── 01175-Prime Arrangements.py │ │ │ ├── 01200-Minimum Absolute Difference.py │ │ │ ├── 01201-Ugly Number III.py │ │ │ ├── 01202-Smallest String With Swaps.py │ │ │ ├── 01206-Design Skiplist.py │ │ │ ├── 01207-Unique Number of Occurrences.py │ │ │ ├── 01208-Get Equal Substrings Within Budget.py │ │ │ ├── 01209-Remove All Adjacent Duplicates in String II.py │ │ │ ├── 01210-Minimum Moves to Reach Target with Rotations.py │ │ │ ├── 01218-Longest Arithmetic Subsequence of Given Difference.py │ │ │ ├── 01219-Path with Maximum Gold.py │ │ │ ├── 01220-Count Vowels Permutation.py │ │ │ ├── 01221-Split a String in Balanced Strings.py │ │ │ ├── 01222-Queens That Can Attack the King.py │ │ │ ├── 01230-Toss Strange Coins.py │ │ │ ├── 01232-Check If It Is a Straight Line.py │ │ │ ├── 01233-Remove Sub-Folders from the Filesystem.py │ │ │ ├── 01235-Maximum Profit in Job Scheduling.py │ │ │ ├── 01238-Circular Permutation in Binary Representation.py │ │ │ ├── 01239-Maximum Length of a Concatenated String with Unique Characters.py │ │ │ ├── 01247-Minimum Swaps to Make Strings Equal.py │ │ │ ├── 01248-Count Number of Nice Subarrays.py │ │ │ ├── 01249-Minimum Remove to Make Valid Parentheses.py │ │ │ ├── 01250-Check If It Is a Good Array.py │ │ │ ├── 01252-Cells with Odd Values in a Matrix.py │ │ │ ├── 01253-Reconstruct a 2-Row Binary Matrix.py │ │ │ ├── 01254-Number of Closed Islands.py │ │ │ ├── 01255-Maximum Score Words Formed by Letters.py │ │ │ ├── 01260-Shift 2D Grid.py │ │ │ ├── 01261-Find Elements in a Contaminated Binary Tree.py │ │ │ ├── 01262-Greatest Sum Divisible by Three.py │ │ │ ├── 01263-Minimum Moves to Move a Box to Their Target Location.py │ │ │ ├── 01266-Minimum Time Visiting All Points.py │ │ │ ├── 01267-Count Servers that Communicate.py │ │ │ ├── 01268-Search Suggestions System.py │ │ │ ├── 01269-Number of Ways to Stay in the Same Place After Some Steps.py │ │ │ ├── 01275-Find Winner on a Tic Tac Toe Game.py │ │ │ ├── 01276-Number of Burgers with No Waste of Ingredients.py │ │ │ ├── 01277-Count Square Submatrices with All Ones.py │ │ │ ├── 01278-Palindrome Partitioning III.py │ │ │ ├── 01281-Subtract the Product and Sum of Digits of an Integer.py │ │ │ ├── 01282-Group the People Given the Group Size They Belong To.py │ │ │ ├── 01283-Find the Smallest Divisor Given a Threshold.py │ │ │ ├── 01284-Minimum Number of Flips to Convert Binary Matrix to Zero Matrix.py │ │ │ ├── 01286-Iterator for Combination.py │ │ │ ├── 01287-Element Appearing More Than 25% In Sorted Array.py │ │ │ ├── 01288-Remove Covered Intervals.py │ │ │ ├── 01289-Minimum Falling Path Sum II.py │ │ │ ├── 01290-Convert Binary Number in a Linked List to Integer.py │ │ │ ├── 01291-Sequential Digits.py │ │ │ ├── 01292-Maximum Side Length of a Square with Sum Less than or Equal to Threshold.py │ │ │ ├── 01293-Shortest Path in a Grid with Obstacles Elimination.py │ │ │ ├── 01295-Find Numbers with Even Number of Digits.py │ │ │ ├── 01297-Maximum Number of Occurrences of a Substring.py │ │ │ ├── 01298-Maximum Candies You Can Get from Boxes.py │ │ │ ├── 01299-Replace Elements with Greatest Element on Right Side.py │ │ │ ├── 01300-Sum of Mutated Array Closest to Target.py │ │ │ ├── 01301-Number of Paths with Max Score.py │ │ │ ├── 01302-Deepest Leaves Sum.py │ │ │ ├── 01304-Find N Unique Integers Sum up to Zero.py │ │ │ ├── 01305-All Elements in Two Binary Search Trees.py │ │ │ ├── 01306-Jump Game III.py │ │ │ ├── 01307-Verbal Arithmetic Puzzle.py │ │ │ ├── 01309-Decrypt String from Alphabet to Integer Mapping.py │ │ │ ├── 01310-XOR Queries of a Subarray.py │ │ │ ├── 01311-Get Watched Videos by Your Friends.py │ │ │ ├── 01312-Minimum Insertion Steps to Make a String Palindrome.py │ │ │ ├── 01313-Decompress Run-Length Encoded List.py │ │ │ ├── 01314-Matrix Block Sum.py │ │ │ ├── 01315-Sum of Nodes with Even-Valued Grandparent.py │ │ │ ├── 01316-Distinct Echo Substrings.py │ │ │ ├── 01317-Convert Integer to the Sum of Two No-Zero Integers.py │ │ │ ├── 01318-Minimum Flips to Make a OR b Equal to c.py │ │ │ ├── 01319-Number of Operations to Make Network Connected.py │ │ │ ├── 01320-Minimum Distance to Type a Word Using Two Fingers.py │ │ │ ├── 01323-Maximum 69 Number.py │ │ │ ├── 01324-Print Words Vertically.py │ │ │ ├── 01325-Delete Leaves With a Given Value.py │ │ │ ├── 01326-Minimum Number of Taps to Open to Water a Garden.py │ │ │ ├── 01330-Reverse Subarray To Maximize Array Value.py │ │ │ ├── 01331-Rank Transform of an Array.py │ │ │ ├── 01332-Remove Palindromic Subsequences.py │ │ │ ├── 01333-Filter Restaurants by Vegan-Friendly, Price and Distance.py │ │ │ ├── 01334-Find the City With the Smallest Number of Neighbors at a Threshold Distance.py │ │ │ ├── 01335-Minimum Difficulty of a Job Schedule.py │ │ │ ├── 01342-Number of Steps to Reduce a Number to Zero.py │ │ │ ├── 01343-Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold.py │ │ │ ├── 01344-Angle Between Hands of a Clock.py │ │ │ ├── 01345-Jump Game IV.py │ │ │ ├── 01346-Check If N and Its Double Exist.py │ │ │ ├── 01347-Minimum Number of Steps to Make Two Strings Anagram.py │ │ │ ├── 01348-Tweet Counts Per Frequency.py │ │ │ ├── 01349-Maximum Students Taking Exam.py │ │ │ ├── 01351-Count Negative Numbers in a Sorted Matrix.py │ │ │ ├── 01352-Product of the Last K Numbers.py │ │ │ ├── 01356-Sort Integers by The Number of 1 Bits.py │ │ │ ├── 01357-Apply Discount Every n Orders.py │ │ │ ├── 01358-Number of Substrings Containing All Three Characters.py │ │ │ ├── 01359-Count All Valid Pickup and Delivery Options.py │ │ │ ├── 01360-Number of Days Between Two Dates.py │ │ │ ├── 01361-Validate Binary Tree Nodes.py │ │ │ ├── 01362-Closest Divisors.py │ │ │ ├── 01363-Largest Multiple of Three.py │ │ │ ├── 01365-How Many Numbers Are Smaller Than the Current Number.py │ │ │ ├── 01366-Rank Teams by Votes.py │ │ │ ├── 01367-Linked List in Binary Tree.py │ │ │ ├── 01368-Minimum Cost to Make at Least One Valid Path in a Grid.py │ │ │ ├── 01370-Increasing Decreasing String.py │ │ │ ├── 01371-Find the Longest Substring Containing Vowels in Even Counts.py │ │ │ ├── 01372-Longest ZigZag Path in a Binary Tree.py │ │ │ ├── 01373-Maximum Sum BST in Binary Tree.py │ │ │ ├── 01374-Generate a String With Characters That Have Odd Counts.py │ │ │ ├── 01375-Bulb Switcher III.py │ │ │ ├── 01376-Time Needed to Inform All Employees.py │ │ │ ├── 01377-Frog Position After T Seconds.py │ │ │ ├── 01379-Find a Corresponding Node of a Binary Tree in a Clone of That Tree.py │ │ │ ├── 01380-Lucky Numbers in a Matrix.py │ │ │ ├── 01381-Design a Stack With Increment Operation.py │ │ │ ├── 01382-Balance a Binary Search Tree.py │ │ │ ├── 01385-Find the Distance Value Between Two Arrays.py │ │ │ ├── 01386-Cinema Seat Allocation.py │ │ │ ├── 01387-Sort Integers by The Power Value.py │ │ │ ├── 01388-Pizza With 3n Slices.py │ │ │ ├── 01390-Four Divisors.py │ │ │ ├── 01391-Check if There is a Valid Path in a Grid.py │ │ │ ├── 01392-Longest Happy Prefix.py │ │ │ ├── 01394-Find Lucky Integer in an Array.py │ │ │ ├── 01395-Count Number of Teams.py │ │ │ ├── 01396-Design Underground System.py │ │ │ ├── 01397-Find All Good Strings.py │ │ │ ├── 01399-Count Largest Group.py │ │ │ ├── 01400-Construct K Palindrome Strings.py │ │ │ ├── 01401-Circle and Rectangle Overlapping.py │ │ │ ├── 01402-Reducing Dishes.py │ │ │ ├── 01403-Minimum Subsequence in Non-Increasing Order.py │ │ │ ├── 01404-Number of Steps to Reduce a Number in Binary Representation to One.py │ │ │ ├── 01405-Longest Happy String.py │ │ │ ├── 01406-Stone Game III.py │ │ │ ├── 01408-String Matching in an Array.py │ │ │ ├── 01410-HTML Entity Parser.py │ │ │ ├── 01411-Number of Ways to Paint N × 3 Grid.py │ │ │ ├── 01413-Minimum Value to Get Positive Step by Step Sum.py │ │ │ ├── 01414-Find the Minimum Number of Fibonacci Numbers Whose Sum Is K.py │ │ │ ├── 01415-The k-th Lexicographical String of All Happy Strings of Length n.py │ │ │ ├── 01416-Restore The Array.py │ │ │ ├── 01417-Reformat The String.py │ │ │ ├── 01418-Display Table of Food Orders in a Restaurant.py │ │ │ ├── 01419-Minimum Number of Frogs Croaking.py │ │ │ ├── 01420-Build Array Where You Can Find The Maximum Exactly K Comparisons.py │ │ │ ├── 01422-Maximum Score After Splitting a String.py │ │ │ ├── 01423-Maximum Points You Can Obtain from Cards.py │ │ │ ├── 01424-Diagonal Traverse II.py │ │ │ ├── 01426-Counting Elements.py │ │ │ ├── 01431-Kids With the Greatest Number of Candies.py │ │ │ ├── 01432-Max Difference You Can Get From Changing an Integer.py │ │ │ ├── 01433-Check If a String Can Break Another String.py │ │ │ ├── 01434-Number of Ways to Wear Different Hats to Each Other.py │ │ │ ├── 01438-Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit.py │ │ │ ├── 01441-Build an Array With Stack Operations.py │ │ │ ├── 01442-Count Triplets That Can Form Two Arrays of Equal XOR.py │ │ │ ├── 01443-Minimum Time to Collect All Apples in a Tree.py │ │ │ ├── 01444-Number of Ways of Cutting a Pizza.py │ │ │ ├── 01450-Number of Students Doing Homework at a Given Time.py │ │ │ ├── 01451-Rearrange Words in a Sentence.py │ │ │ ├── 01452-People Whose List of Favorite Companies Is Not a Subset of Another List.py │ │ │ ├── 01453-Maximum Number of Darts Inside of a Circular Dartboard.py │ │ │ ├── 01455-Check If a Word Occurs As a Prefix of Any Word in a Sentence.py │ │ │ ├── 01456-Maximum Number of Vowels in a Substring of Given Length.py │ │ │ ├── 01457-Pseudo-Palindromic Paths in a Binary Tree.py │ │ │ ├── 01458-Max Dot Product of Two Subsequences.py │ │ │ ├── 01460-Make Two Arrays Equal by Reversing Sub-arrays.py │ │ │ ├── 01461-Check If a String Contains All Binary Codes of Size K.py │ │ │ ├── 01462-Course Schedule IV.py │ │ │ ├── 01463-Cherry Pickup II.py │ │ │ ├── 01464-Maximum Product of Two Elements in an Array.py │ │ │ ├── 01465-Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts.py │ │ │ ├── 01466-Reorder Routes to Make All Paths Lead to the City Zero.py │ │ │ ├── 01467-Probability of a Two Boxes Having The Same Number of Distinct Balls.py │ │ │ ├── 01470-Shuffle the Array.py │ │ │ ├── 01471-The k Strongest Values in an Array.py │ │ │ ├── 01472-Design Browser History.py │ │ │ ├── 01473-Paint House III.py │ │ │ ├── 01475-Final Prices With a Special Discount in a Shop.py │ │ │ ├── 01476-Subrectangle Queries.py │ │ │ ├── 01477-Find Two Non-overlapping Sub-arrays Each With Target Sum.py │ │ │ ├── 01480-Running Sum of 1d Array.py │ │ │ ├── 01481-Least Number of Unique Integers after K Removals.py │ │ │ ├── 01482-Minimum Number of Days to Make m Bouquets.py │ │ │ ├── 01483-Kth Ancestor of a Tree Node.py │ │ │ ├── 01486-XOR Operation in an Array.py │ │ │ ├── 01487-Making File Names Unique.py │ │ │ ├── 01489-Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree.py │ │ │ ├── 01491-Average Salary Excluding the Minimum and Maximum Salary.py │ │ │ ├── 01492-The kth Factor of n.py │ │ │ ├── 01493-Longest Subarray of 1's After Deleting One Element.py │ │ │ ├── 01496-Path Crossing.py │ │ │ ├── 01497-Check If Array Pairs Are Divisible by k.py │ │ │ ├── 01498-Number of Subsequences That Satisfy the Given Sum Condition.py │ │ │ ├── 01499-Max Value of Equation.py │ │ │ ├── 01502-Can Make Arithmetic Progression From Sequence.py │ │ │ ├── 01503-Last Moment Before All Ants Fall Out of a Plank.py │ │ │ ├── 01504-Count Submatrices With All Ones.py │ │ │ ├── 01505-Minimum Possible Integer After at Most K Adjacent Swaps On Digits.py │ │ │ ├── 01507-Reformat Date.py │ │ │ ├── 01509-Minimum Difference Between Largest and Smallest Value in Three Moves.py │ │ │ ├── 01510-Stone Game IV.py │ │ │ ├── 01512-Number of Good Pairs.py │ │ │ ├── 01513-Number of Substrings With Only 1s.py │ │ │ ├── 01514-Path with Maximum Probability.py │ │ │ ├── 01515-Best Position for a Service Centre.py │ │ │ ├── 01520-Maximum Number of Non-Overlapping Substrings.py │ │ │ ├── 01521-Find a Value of a Mysterious Function Closest to Target.py │ │ │ ├── 01523-Count Odd Numbers in an Interval Range.py │ │ │ ├── 01524-Number of Sub-arrays With Odd Sum.py │ │ │ ├── 01525-Number of Good Ways to Split a String.cc │ │ │ ├── 01526-Minimum Number of Increments on Subarrays to Form a Target Array.py │ │ │ ├── 01528-Shuffle String.py │ │ │ ├── 01529-Bulb Switcher IV.py │ │ │ ├── 01530-Number of Good Leaf Nodes Pairs.py │ │ │ ├── 01536-Minimum Swaps to Arrange a Binary Grid.py │ │ │ ├── 01537-Get the Maximum Score.py │ │ │ ├── 01539-Kth Missing Positive Number.py │ │ │ ├── 01540-Can Convert String in K Moves.py │ │ │ ├── 01541-Minimum Insertions to Balance a Parentheses String.py │ │ │ ├── 01542-Find Longest Awesome Substring.py │ │ │ ├── 01544-Make The String Great.py │ │ │ ├── 01545-Find Kth Bit in Nth Binary String.py │ │ │ ├── 01546-Maximum Number of Non-Overlapping Subarrays With Sum Equals Target.py │ │ │ ├── 01547-Minimum Cost to Cut a Stick.py │ │ │ ├── 01550-Three Consecutive Odds.py │ │ │ ├── 01551-Minimum Operations to Make Array Equal.py │ │ │ ├── 01552-Magnetic Force Between Two Balls.py │ │ │ ├── 01553-Minimum Number of Days to Eat N Oranges.py │ │ │ ├── 01557-Minimum Number of Vertices to Reach All Nodes.py │ │ │ ├── 01558-Minimum Numbers of Function Calls to Make Target Array.py │ │ │ ├── 01559-Detect Cycles in 2D Grid.py │ │ │ ├── 01560-Most Visited Sector in a Circular Track.py │ │ │ ├── 01561-Maximum Number of Coins You Can Get.py │ │ │ ├── 01562-Find Latest Group of Size M.py │ │ │ ├── 01566-Detect Pattern of Length M Repeated K or More Times.py │ │ │ ├── 01567-Maximum Length of Subarray With Positive Product.py │ │ │ ├── 01568-Minimum Number of Days to Disconnect Island.py │ │ │ ├── 01569-Number of Ways to Reorder Array to Get Same BST.py │ │ │ ├── 01572-Matrix Diagonal Sum.py │ │ │ ├── 01573-Number of Ways to Split a String.py │ │ │ ├── 01574-Shortest Subarray to be Removed to Make Array Sorted.py │ │ │ ├── 01575-Count All Possible Routes.py │ │ │ ├── 01576-Replace All Question Marks to Avoid Consecutive Repeating Characters.py │ │ │ ├── 01577-Number of Ways Where Square of Number Is Equal to Product of Two Numbers.py │ │ │ ├── 01578-Minimum Deletion Cost to Avoid Repeating Letters.py │ │ │ ├── 01579-Remove Max Number of Edges to Keep Graph Fully Traversable.py │ │ │ ├── 01582-Special Positions in a Binary Matrix.py │ │ │ ├── 01583-Count Unhappy Friends.py │ │ │ ├── 01584-Min Cost to Connect All Points.py │ │ │ ├── 01585-Check If String Is Transformable With Substring Sort Operations.py │ │ │ ├── 01588-Sum of All Odd Length Subarrays.py │ │ │ ├── 01589-Maximum Sum Obtained of Any Permutation.py │ │ │ ├── 01590-Make Sum Divisible by P.py │ │ │ ├── 01591-Strange Printer II.py │ │ │ ├── 01592-Rearrange Spaces Between Words.py │ │ │ ├── 01593-Split a String Into the Max Number of Unique Substrings.py │ │ │ ├── 01594-Maximum Non Negative Product in a Matrix.py │ │ │ ├── 01598-Crawler Log Folder.py │ │ │ ├── 01599-Maximum Profit of Operating a Centennial Wheel.py │ │ │ ├── 01600-Throne Inheritance.py │ │ │ ├── 01601-Maximum Number of Achievable Transfer Requests.py │ │ │ ├── 01603-Design Parking System.py │ │ │ ├── 01604-Alert Using Same Key-Card Three or More Times in a One Hour Period.py │ │ │ ├── 01605-Find Valid Matrix Given Row and Column Sums.py │ │ │ ├── 01608-Special Array With X Elements Greater Than or Equal X.py │ │ │ ├── 01609-Even Odd Tree.py │ │ │ ├── 01610-Maximum Number of Visible Points.py │ │ │ ├── 01611-Minimum One Bit Operations to Make Integers Zero.py │ │ │ ├── 01614-Maximum Nesting Depth of the Parentheses.py │ │ │ ├── 01615-Maximal Network Rank.py │ │ │ ├── 01616-Split Two Strings to Make Palindrome.py │ │ │ ├── 01617-Count Subtrees With Max Distance Between Cities.py │ │ │ ├── 01619-Mean of Array After Removing Some Elements.py │ │ │ ├── 01620-Coordinate With Maximum Network Quality.py │ │ │ ├── 01621-Number of Sets of K Non-Overlapping Line Segments.py │ │ │ ├── 01622-Fancy Sequence.py │ │ │ ├── 01624-Largest Substring Between Two Equal Characters.py │ │ │ ├── 01625-Lexicographically Smallest String After Applying Operations.py │ │ │ ├── 01626-Best Team With No Conflicts.py │ │ │ ├── 01627-Graph Connectivity With Threshold.py │ │ │ ├── 01629-Slowest Key.py │ │ │ ├── 01630-Arithmetic Subarrays.py │ │ │ ├── 01631-Path With Minimum Effort.py │ │ │ ├── 01632-Rank Transform of a Matrix.py │ │ │ ├── 01636-Sort Array by Increasing Frequency.py │ │ │ ├── 01637-Widest Vertical Area Between Two Points Containing No Points.py │ │ │ ├── 01638-Count Substrings That Differ by One Character.py │ │ │ ├── 01639-Number of Ways to Form a Target String Given a Dictionary.py │ │ │ ├── 01640-Check Array Formation Through Concatenation.py │ │ │ ├── 01641-Count Sorted Vowel Strings.py │ │ │ ├── 01643-Kth Smallest Instructions.py │ │ │ ├── 01646-Get Maximum in Generated Array.py │ │ │ ├── 01647-Minimum Deletions to Make Character Frequencies Unique.py │ │ │ ├── 01648-Sell Diminishing-Valued Colored Balls.py │ │ │ ├── 01649-Create Sorted Array through Instructions.py │ │ │ ├── 01652-Defuse the Bomb.py │ │ │ ├── 01653-Minimum Deletions to Make String Balanced.py │ │ │ ├── 01654-Minimum Jumps to Reach Home.py │ │ │ ├── 01655-Distribute Repeating Integers.py │ │ │ ├── 01656-Design an Ordered Stream.py │ │ │ ├── 01657-Determine if Two Strings Are Close.py │ │ │ ├── 01658-Minimum Operations to Reduce X to Zero.py │ │ │ ├── 01659-Maximize Grid Happiness.py │ │ │ ├── 01662-Check If Two String Arrays are Equivalent.py │ │ │ ├── 01663-Smallest String With A Given Numeric Value.py │ │ │ ├── 01664-Ways to Make a Fair Array.py │ │ │ ├── 01665-Minimum Initial Energy to Finish Tasks.py │ │ │ ├── 01668-Maximum Repeating Substring.py │ │ │ ├── 01669-Merge In Between Linked Lists.py │ │ │ ├── 01670-Design Front Middle Back Queue.py │ │ │ ├── 01672-Richest Customer Wealth.py │ │ │ ├── 01673-Find the Most Competitive Subsequence.py │ │ │ ├── 01674-Minimum Moves to Make Array Complementary.py │ │ │ ├── 01675-Minimize Deviation in Array.py │ │ │ ├── 01678-Goal Parser Interpretation.py │ │ │ ├── 01679-Max Number of K-Sum Pairs.py │ │ │ ├── 01680-Concatenation of Consecutive Binary Numbers1680. Concatenation of Consecutive Binary Numbers.py │ │ │ ├── 01681-Minimum Incompatibility.py │ │ │ ├── 01684-Count the Number of Consistent Strings.py │ │ │ ├── 01685-Sum of Absolute Differences in a Sorted Array.py │ │ │ ├── 01686-Stone Game VI.py │ │ │ ├── 01687-Delivering Boxes from Storage to Ports.py │ │ │ ├── 01688-Count of Matches in Tournament.py │ │ │ ├── 01689-Partitioning Into Minimum Number Of Deci-Binary Numbers.py │ │ │ ├── 01690-Stone Game VII.py │ │ │ ├── 01691-Maximum Height by Stacking Cuboids.py │ │ │ ├── 01694-Reformat Phone Number.py │ │ │ ├── 01695-Maximum Erasure Value.py │ │ │ ├── 01696-Jump Game VI.py │ │ │ ├── 01697-Checking Existence of Edge Length Limited Paths.py │ │ │ ├── 01700-Number of Students Unable to Eat Lunch.py │ │ │ ├── 01701-Average Waiting Time.py │ │ │ ├── 01702-Maximum Binary String After Change.py │ │ │ ├── 01703-Minimum Adjacent Swaps for K Consecutive Ones.py │ │ │ ├── 01704-Determine if String Halves Are Alike.py │ │ │ ├── 01705-Maximum Number of Eaten Apples.py │ │ │ ├── 01706-Where Will the Ball Fall.py │ │ │ ├── 01710-Maximum Units on a Truck.py │ │ │ ├── 01711-Count Good Meals.py │ │ │ ├── 01712-Ways to Split Array Into Three Subarrays.py │ │ │ ├── 01713-Minimum Operations to Make a Subsequence.py │ │ │ ├── 01716-Calculate Money in Leetcode Bank.py │ │ │ ├── 01717-Maximum Score From Removing Substrings.py │ │ │ ├── 01718-Construct the Lexicographically Largest Valid Sequence.py │ │ │ ├── 01719-Number Of Ways To Reconstruct A Tree.py │ │ │ ├── 01720-Decode XORed Array.py │ │ │ ├── 01721-Swapping Nodes in a Linked List.py │ │ │ ├── 01722-Minimize Hamming Distance After Swap Operations.py │ │ │ ├── 01723-Find Minimum Time to Finish All Jobs.py │ │ │ ├── 01779-Find Nearest Point That Has the Same X or Y Coordinate.py │ │ │ ├── 01780-Check if Number is a Sum of Powers of Three.py │ │ │ ├── 01781-Sum of Beauty of All Substrings.py │ │ │ ├── 01782-Count Pairs Of Nodes.py │ │ │ ├── 01784-Check if Binary String Has at Most One Segment of Ones.py │ │ │ ├── 01785-Minimum Elements to Add to Form a Given Sum.py │ │ │ ├── 01786-Number of Restricted Paths From First to Last Node.py │ │ │ ├── 01787-Make the XOR of All Segments Equal to Zero.py │ │ │ ├── 01790-Check if One String Swap Can Make Strings Equal.py │ │ │ ├── 01791-Find Center of Star Graph.py │ │ │ ├── 01792-Maximum Average Pass Ratio.py │ │ │ ├── 01793-Maximum Score of a Good Subarray.py │ │ │ ├── 01827-Minimum Operations to Make the Array Increasing.py │ │ │ ├── 01828-Queries on Number of Points Inside a Circle.py │ │ │ ├── 01829-Maximum XOR for Each Query.py │ │ │ ├── 01832-Check if the Sentence Is Pangram.py │ │ │ ├── 01833-Maximum Ice Cream Bars.py │ │ │ ├── 01835-Find XOR Sum of All Pairs Bitwise AND.py │ │ │ ├── 01844-Replace All Digits with Characters.py │ │ │ ├── 01846-Maximum Element After Decreasing and Rearranging.py │ │ │ ├── 01860-Incremental Memory Leak.py │ │ │ ├── 01862-Sum of Floored Pairs.py │ │ │ ├── 01863-Sum of All Subset XOR Totals.py │ │ │ ├── 01864-Minimum Number of Swaps to Make the Binary String Alternating.py │ │ │ ├── 01865-Finding Pairs With a Certain Sum.py │ │ │ ├── 01866-Number of Ways to Rearrange Sticks With K Sticks Visible.py │ │ │ ├── 01869-Longer Contiguous Segments of Ones than Zeros.py │ │ │ ├── 01870-Minimum Speed to Arrive on Time.py │ │ │ ├── 01871-Jump Game VII.py │ │ │ ├── 01872-Stone Game VIII.py │ │ │ ├── 01876-Substrings of Size Three with Distinct Characters.py │ │ │ ├── 01877-Minimize Maximum Pair Sum in Array.py │ │ │ ├── 01878-Get Biggest Three Rhombus Sums in a Grid.py │ │ │ ├── 01879-Minimum XOR Sum of Two Arrays.py │ │ │ ├── 01880-Check if Word Equals Summation of Two Words.py │ │ │ ├── 01881-Maximum Value after Insertion.py │ │ │ ├── 01882-Process Tasks Using Servers.py │ │ │ ├── 01883-Minimum Skips to Arrive at Meeting On Time.py │ │ │ ├── 01884-Egg Drop With 2 Eggs and N Floors.py │ │ │ ├── 01886-Determine Whether Matrix Can Be Obtained By Rotation.py │ │ │ ├── 01887-Reduction Operations to Make the Array Elements Equal.py │ │ │ ├── 01888-Minimum Number of Flips to Make the Binary String Alternating.py │ │ │ ├── 01889-Minimum Space Wasted From Packaging.py │ │ │ ├── 01893-Check if All the Integers in a Range Are Covered.py │ │ │ ├── 01894-Find the Student that Will Replace the Chalk.py │ │ │ ├── 01896-Minimum Cost to Change the Final Value of Expression.py │ │ │ ├── 01897-Redistribute Characters to Make All Strings Equal.py │ │ │ ├── 01898-Maximum Number of Removable Characters.py │ │ │ ├── 01899-Merge Triplets to Form Target Triplet.py │ │ │ ├── 01900-The Earliest and Latest Rounds Where Players Compete.py │ │ │ ├── 01901-Find a Peak Element II.py │ │ │ ├── 01903-Largest Odd Number in String.py │ │ │ ├── 01904-The Number of Full Rounds You Have Played.py │ │ │ ├── 01905-Count Sub Islands.py │ │ │ ├── 01906-Minimum Absolute Difference Queries.py │ │ │ ├── 01909-Remove One Element to Make the Array Strictly Increasing.py │ │ │ ├── 01910-Remove All Occurrences of a Substring.py │ │ │ ├── 01911-Maximum Alternating Subsequence Sum.py │ │ │ ├── 01913-Maximum Product Difference Between Two Pairs.py │ │ │ ├── 01914-Cyclically Rotating a Grid.py │ │ │ ├── 01915-Number of Wonderful Substrings.py │ │ │ ├── 01916-Count Ways to Build Rooms in an Ant Colony.py │ │ │ ├── 01920-Build Array from Permutation.py │ │ │ ├── 01921-Eliminate Maximum Number of Monsters.py │ │ │ ├── 01922-Count Good Numbers.py │ │ │ ├── 01923-Longest Common Subpath.py │ │ │ ├── 01925-Count Square Sum Triples.py │ │ │ ├── 01926-Nearest Exit from Entrance in Maze.py │ │ │ ├── 01927-Sum Game.py │ │ │ ├── 01929-Concatenation of Array.py │ │ │ ├── 01930-Unique Length-3 Palindromic Subsequences.py │ │ │ ├── 01931-Painting a Grid With Three Different Colors.py │ │ │ ├── 01932-Merge BSTs to Create Single BST.py │ │ │ ├── 01935-Maximum Number of Words You Can Type.py │ │ │ ├── 01936-Add Minimum Number of Rungs.py │ │ │ ├── 01937-Maximum Number of Points with Cost.py │ │ │ ├── 01941-Check if All Characters Have Equal Number of Occurrences.py │ │ │ ├── 01943-Describe the Painting.py │ │ │ ├── 01944-Number of Visible People in a Queue.py │ │ │ ├── 01945-Sum of Digits of String After Convert.py │ │ │ ├── 01946-Largest Number After Mutating Substring.py │ │ │ ├── 01947-Maximum Compatibility Score Sum.py │ │ │ ├── 01948-Delete Duplicate Folders in System.py │ │ │ ├── 01967-Number of Strings That Appear as Substrings in Word.py │ │ │ ├── 01968-Array With Elements Not Equal to Average of Neighbors.py │ │ │ ├── 01969-Minimum Non-Zero Product of the Array Elements.py │ │ │ ├── 01970-Last Day Where You Can Still Cross.py │ │ │ ├── 01971-Find if Path Exists in Graph.py │ │ │ ├── 01974-Minimum Time to Type Word Using Special Typewriter.py │ │ │ ├── 01975-Maximum Matrix Sum.py │ │ │ ├── 01977-Number of Ways to Separate Numbers.py │ │ │ ├── 01979-Find Greatest Common Divisor of Array.py │ │ │ ├── 01980-Find Unique Binary String.py │ │ │ ├── 01981-Minimize the Difference Between Target and Chosen Elements.py │ │ │ ├── 01982-Find Array Given Subset Sums.py │ │ │ ├── 01984-Minimum Difference Between Highest and Lowest of K Scores.py │ │ │ ├── 01985-Find the Kth Largest Integer in the Array.py │ │ │ ├── 01987-Number of Unique Good Subsequences.py │ │ │ ├── 01991-Find the Middle Index in Array.py │ │ │ ├── 01992-Find All Groups of Farmland.py │ │ │ ├── 01993-Operations on Tree.py │ │ │ ├── 01994-The Number of Good Subsets.py │ │ │ ├── 01997-First Day Where You Have Been in All the Rooms.py │ │ │ └── 01998-GCD Sort of an Array.py │ │ ├── 2000 │ │ │ ├── 02011-Final Value of Variable After Performing Operations.py │ │ │ ├── 02047-Number of Valid Words in a Sentence.py │ │ │ ├── 02062-Count Vowel Substrings of a String.py │ │ │ ├── 02063-Vowels of All Substrings.py │ │ │ ├── 02064-Minimized Maximum of Products Distributed to Any Store.py │ │ │ ├── 02068-Check Whether Two Strings are Almost Equivalent.py │ │ │ ├── 02069-Walking Robot Simulation II.py │ │ │ ├── 02070-Most Beautiful Item for Each Query.py │ │ │ ├── 02073-Time Needed to Buy Tickets.py │ │ │ ├── 02074-Reverse Nodes in Even Length Groups.py │ │ │ ├── 02075-Decode the Slanted Ciphertext.py │ │ │ ├── 02076-Process Restricted Friend Requests.py │ │ │ ├── 02078-Two Furthest Houses With Different Colors.py │ │ │ ├── 02079-Watering Plants.py │ │ │ ├── 02080-Range Frequency Queries.py │ │ │ ├── 02081-Sum of k-Mirror Numbers.py │ │ │ ├── 02091-Removing Minimum and Maximum From Array.py │ │ │ ├── 02129-Capitalize the Title.py │ │ │ ├── 02130-Maximum Twin Sum of a Linked List.py │ │ │ ├── 02131-Longest Palindrome by Concatenating Two Letter Words.py │ │ │ ├── 02132-Stamping the Grid.py │ │ │ ├── 02134-Minimum Swaps to Group All 1's Together II.py │ │ │ ├── 02135-Count Words Obtained After Adding a Letter.py │ │ │ ├── 02136-Earliest Possible Day of Full Bloom.py │ │ │ ├── 02138-Divide a String Into Groups of Size k.py │ │ │ ├── 02139-Minimum Moves to Reach Target Score.py │ │ │ ├── 02140-Solving Questions With Brainpower.py │ │ │ ├── 02141-Maximum Running Time of N Computers.py │ │ │ ├── 02144-Minimum Cost of Buying Candies With Discount.py │ │ │ ├── 02145-Count the Hidden Sequences.py │ │ │ ├── 02146-K Highest Ranked Items Within a Price Range.py │ │ │ ├── 02147-Number of Ways to Divide a Long Corridor.py │ │ │ ├── 02148-Count Elements With Strictly Smaller and Greater Elements.py │ │ │ ├── 02149-Rearrange Array Elements by Sign.py │ │ │ ├── 02150-Find All Lonely Numbers in the Array.py │ │ │ ├── 02151-Maximum Good People Based on Statements.py │ │ │ ├── 02154-Keep Multiplying Found Values by Two.py │ │ │ ├── 02155-All Divisions With the Highest Score of a Binary Array.py │ │ │ ├── 02156-Find Substring With Given Hash Value.py │ │ │ ├── 02157-Groups of Strings.py │ │ │ ├── 02160-Minimum Sum of Four Digit Number After Splitting Digits.py │ │ │ ├── 02161-Partition Array According to Given Pivot.py │ │ │ ├── 02162-Minimum Cost to Set Cooking Time.py │ │ │ ├── 02164-Sort Even and Odd Indices Independently.py │ │ │ ├── 02165-Smallest Value of the Rearranged Number.py │ │ │ ├── 02166-Design Bitset.py │ │ │ ├── 02167-Minimum Time to Remove All Cars Containing Illegal Goods.py │ │ │ ├── 02169-Count Operations to Obtain Zero.py │ │ │ ├── 02170-Minimum Operations to Make the Array Alternating.py │ │ │ ├── 02171-Removing Minimum Number of Magic Beans.py │ │ │ ├── 02176-Count Equal and Divisible Pairs in an Array.py │ │ │ ├── 02177-Find Three Consecutive Integers That Sum to a Given Number.py │ │ │ ├── 02178-Maximum Split of Positive Even Integers.py │ │ │ ├── 02179-Count Good Triplets in an Array.py │ │ │ ├── 02200-Find All K-Distant Indices in an Array.py │ │ │ ├── 02209-Minimum White Tiles After Covering With Carpets.py │ │ │ ├── 02210-Count Hills and Valleys in an Array.py │ │ │ ├── 02211-Count Collisions on a Road.py │ │ │ ├── 02212-Maximum Points in an Archery Competition.py │ │ │ ├── 02215-Find the Difference of Two Arrays.py │ │ │ ├── 02216-Minimum Deletions to Make Array Beautiful.py │ │ │ ├── 02217-Find Palindrome With Fixed Length.py │ │ │ ├── 02218-Maximum Value of K Coins From Piles.py │ │ │ ├── 02220-Minimum Bit Flips to Convert Number.py │ │ │ ├── 02221-Find Triangular Sum of an Array.py │ │ │ ├── 02222-Number of Ways to Select Buildings.py │ │ │ ├── 02223-Sum of Scores of Built Strings.py │ │ │ ├── 02224-Minimum Number of Operations to Convert Time.py │ │ │ ├── 02225-Find Players With Zero or One Losses.py │ │ │ ├── 02226-Maximum Candies Allocated to K Children.py │ │ │ ├── 02227-Encrypt and Decrypt Strings.py │ │ │ ├── 02231-Largest Number After Digit Swaps by Parity.py │ │ │ ├── 02232-Minimize Result by Adding Parentheses to Expression.py │ │ │ ├── 02234-Maximum Total Beauty of the Gardens.py │ │ │ ├── 02236-Root Equals Sum of Children.py │ │ │ ├── 02239-Find Closest Number to Zero.py │ │ │ ├── 02240-Number of Ways to Buy Pens and Pencils.py │ │ │ ├── 02241-Design an ATM Machine.py │ │ │ ├── 02242-Maximum Score of a Node Sequence.py │ │ │ ├── 02243-Calculate Digit Sum of a String.py │ │ │ ├── 02244-Minimum Rounds to Complete All Tasks.py │ │ │ ├── 02245-Maximum Trailing Zeros in a Cornered Path.py │ │ │ ├── 02246-Longest Path With Different Adjacent Characters.py │ │ │ ├── 02248-Intersection of Multiple Arrays.py │ │ │ ├── 02250-Count Number of Rectangles Containing Each Point.py │ │ │ ├── 02251-Number of Flowers in Full Bloom.py │ │ │ ├── 02255-Count Prefixes of a Given String.py │ │ │ ├── 02256-Minimum Average Difference.py │ │ │ ├── 02257-Count Unguarded Cells in the Grid.py │ │ │ ├── 02258-Escape the Spreading Fire.py │ │ │ ├── 02259-Remove Digit From Number to Maximize Result.py │ │ │ ├── 02260-Minimum Consecutive Cards to Pick Up.py │ │ │ ├── 02261-K Divisible Elements Subarrays.py │ │ │ ├── 02262-Total Appeal of A String.py │ │ │ ├── 02264-Largest 3-Same-Digit Number in String.py │ │ │ ├── 02265-Count Nodes Equal to Average of Subtree.py │ │ │ ├── 02266-Count Number of Texts.py │ │ │ ├── 02267-Check if There Is a Valid Parentheses String Path.py │ │ │ ├── 02269-Find the K-Beauty of a Number.py │ │ │ ├── 02270-Number of Ways to Split Array.py │ │ │ ├── 02271-Maximum White Tiles Covered by a Carpet.py │ │ │ ├── 02272-Substring With Largest Variance.py │ │ │ ├── 02273-Find Resultant Array After Removing Anagrams.py │ │ │ ├── 02274-Maximum Consecutive Floors Without Special Floors.py │ │ │ ├── 02275-Largest Combination With Bitwise AND Greater Than Zero.py │ │ │ ├── 02278-Percentage of Letter in String.py │ │ │ ├── 02279-Maximum Bags With Full Capacity of Rocks.py │ │ │ ├── 02280-Minimum Lines to Represent a Line Chart.py │ │ │ ├── 02283-Check if Number Has Equal Digit Count and Digit Value.py │ │ │ ├── 02284-Sender With Largest Word Count.py │ │ │ ├── 02285-Maximum Total Importance of Roads.py │ │ │ ├── 02287-Rearrange Characters to Make Target String.py │ │ │ ├── 02288-Apply Discount to Prices.py │ │ │ ├── 02289-Steps to Make Array Non-decreasing.py │ │ │ ├── 02293-Min Max Game.py │ │ │ ├── 02294-Partition Array Such That Maximum Difference Is K.py │ │ │ ├── 02295-Replace Elements in an Array.py │ │ │ ├── 02299-Strong Password Checker II.py │ │ │ ├── 02300-Successful Pairs of Spells and Potions.py │ │ │ ├── 02342-Max Sum of a Pair With Equal Sum of Digits.py │ │ │ ├── 02343-Query Kth Smallest Trimmed Number.py │ │ │ ├── 02347-Best Poker Hand.py │ │ │ ├── 02348-Number of Zero-Filled Subarrays.py │ │ │ ├── 02350-Shortest Impossible Sequence of Rolls.py │ │ │ ├── 02351-First Letter to Appear Twice.py │ │ │ ├── 02352-Equal Row and Column Pairs.py │ │ │ ├── 02354-Number of Excellent Pairs.py │ │ │ ├── 02357-Make Array Zero by Subtracting Equal Amounts.py │ │ │ ├── 02358-Maximum Number of Groups Entering a Competition.py │ │ │ ├── 02359-Find Closest Node to Given Two Nodes.py │ │ │ ├── 02363-Merge Similar Items.py │ │ │ ├── 02364-Count Number of Bad Pairs.py │ │ │ ├── 02365-Task Scheduler II.py │ │ │ ├── 02366-Minimum Replacements to Sort the Array.py │ │ │ ├── 02367-Number of Arithmetic Triplets.py │ │ │ ├── 02368-Reachable Nodes With Restrictions.py │ │ │ ├── 02369-Check if There is a Valid Partition For The Array.py │ │ │ ├── 02370-Longest Ideal Subsequence.py │ │ │ ├── 02373-Largest Local Values in a Matrix.py │ │ │ ├── 02374-Node With Highest Edge Score.py │ │ │ ├── 02375-Construct Smallest Number From DI String.py │ │ │ ├── 02376-Count Special Integers.py │ │ │ ├── 02379-Minimum Recolors to Get K Consecutive Black Blocks.py │ │ │ ├── 02380-Time Needed to Rearrange a Binary String.py │ │ │ ├── 02381-Shifting Letters II.py │ │ │ ├── 02383-Minimum Hours of Training to Win a Competition.py │ │ │ ├── 02384-Largest Palindromic Number.py │ │ │ ├── 02385-Amount of Time for Binary Tree to Be Infected.py │ │ │ ├── 02418-Sort the People.py │ │ │ ├── 02419-Longest Subarray With Maximum Bitwise AND.py │ │ │ ├── 02423-Remove Letter To Equalize Frequency.py │ │ │ ├── 02424-Longest Uploaded Prefix.py │ │ │ ├── 02425-Bitwise XOR of All Pairings.py │ │ │ ├── 02426-Number of Pairs Satisfying Inequality.py │ │ │ ├── 02460-Apply Operations to an Array.py │ │ │ ├── 02461-Maximum Sum of Distinct Subarrays With Length K.py │ │ │ ├── 02465-Number of Distinct Averages.py │ │ │ ├── 02466-Count Ways To Build Good Strings.py │ │ │ ├── 02467-Most Profitable Path in a Tree.py │ │ │ ├── 02540-Minimum Common Value.py │ │ │ ├── 02541-Minimum Operations to Make Array Equal II.py │ │ │ ├── 02543-Check if Point Is Reachable.py │ │ │ ├── 02544-Alternating Digit Sum.py │ │ │ ├── 02545-Sort the Students by Their Kth Score.py │ │ │ ├── 02546-Apply Bitwise Operations to Make Strings Equal.py │ │ │ ├── 02547-Minimum Cost to Split an Array.py │ │ │ ├── 02558-Take Gifts From the Richest Pile.py │ │ │ ├── 02562-Find the Array Concatenation Value.py │ │ │ ├── 02563-Count the Number of Fair Pairs.py │ │ │ ├── 02564-Substring XOR Queries.py │ │ │ ├── 02565-Subsequence With the Minimum Score.py │ │ │ ├── 02586-Count the Number of Vowel Strings in Range.py │ │ │ ├── 02587-Rearrange Array to Maximize Prefix Score.py │ │ │ ├── 02588-Count the Number of Beautiful Subarrays.py │ │ │ ├── 02591-Distribute Money to Maximum Children.py │ │ │ ├── 02592-Maximize Greatness of an Array.py │ │ │ ├── 02593-Find Score of an Array After Marking All Elements.py │ │ │ ├── 02594-Minimum Time to Repair Cars.py │ │ │ ├── 02595-Number of Even and Odd Bits.py │ │ │ ├── 02596-Check Knight Tour Configuration.py │ │ │ ├── 02597-The Number of Beautiful Subsets.py │ │ │ ├── 02598-Smallest Missing Non-negative Integer After Operations.py │ │ │ ├── 02600-K Items With the Maximum Sum.py │ │ │ ├── 02601-Prime Subtraction Operation.py │ │ │ ├── 02605-Form Smallest Number From Two Digit Arrays.py │ │ │ ├── 02606-Find the Substring With Maximum Cost.py │ │ │ ├── 02607-Make K-Subarray Sums Equal.py │ │ │ ├── 02609-Find the Longest Balanced Substring of a Binary String.py │ │ │ ├── 02610-Convert an Array Into a 2D Array With Conditions.py │ │ │ ├── 02611-Mice and Cheese.py │ │ │ ├── 02614-Prime In Diagonal.py │ │ │ ├── 02615-Sum of Distances.py │ │ │ ├── 02639-Find the Width of Columns of a Grid.py │ │ │ ├── 02640-Find the Score of All Prefixes of an Array.py │ │ │ ├── 02641-Cousins in Binary Tree II.py │ │ │ ├── 02643-Row With Maximum Ones.py │ │ │ ├── 02644-Find the Maximum Divisibility Score.py │ │ │ ├── 02645-Minimum Additions to Make Valid String.py │ │ │ ├── 02646-Minimize the Total Price of the Trips.py │ │ │ ├── 02651-Calculate Delayed Arrival Time.py │ │ │ ├── 02652-Sum Multiples.py │ │ │ ├── 02653-Sliding Subarray Beauty.py │ │ │ ├── 02654-Minimum Number of Operations to Make All Array Elements Equal to 1.py │ │ │ ├── 02656-Maximum Sum With Exactly K Elements.py │ │ │ ├── 02657-Find the Prefix Common Array of Two Arrays.py │ │ │ ├── 02660-Determine the Winner of a Bowling Game.py │ │ │ ├── 02661-First Completely Painted Row or Column.py │ │ │ ├── 02662-Minimum Cost of a Path With Special Roads.py │ │ │ ├── 02663-Lexicographically Smallest Beautiful String.py │ │ │ ├── 02670-Find the Distinct Difference Array.py │ │ │ ├── 02671-Frequency Tracker.py │ │ │ ├── 02673-Make Costs of Paths Equal in a Binary Tree.py │ │ │ ├── 02729-Check if The Number is Fascinating.py │ │ │ ├── 02730-Find the Longest Semi-Repetitive Substring.py │ │ │ ├── 02731-Movement of Robots.py │ │ │ ├── 02732-Find a Good Subset of the Matrix.py │ │ │ ├── 02733-Neither Minimum nor Maximum.py │ │ │ ├── 02734-Lexicographically Smallest String After Substring Operation.py │ │ │ ├── 02735-Collecting Chocolates.py │ │ │ ├── 02739-Total Distance Traveled.py │ │ │ ├── 02740-Find the Value of the Partition.py │ │ │ ├── 02742-Painting the Walls.py │ │ │ ├── 02744-Find Maximum Number of String Pairs.py │ │ │ ├── 02745-Construct the Longest New String.py │ │ │ ├── 02746-Decremental String Concatenation.py │ │ │ ├── 02747-Count Zero Request Servers.py │ │ │ ├── 02748-Number of Beautiful Pairs.py │ │ │ ├── 02749-Minimum Operations to Make the Integer Zero.py │ │ │ ├── 02750-Ways to Split Array Into Good Subarrays.py │ │ │ ├── 02751-Robot Collisions.py │ │ │ ├── 02760-Longest Even Odd Subarray With Threshold.py │ │ │ ├── 02761-Prime Pairs With Target Sum.py │ │ │ ├── 02762-Continuous Subarrays.py │ │ │ ├── 02763-Sum of Imbalance Numbers of All Subarrays.py │ │ │ ├── 02765-Longest Alternating Subarray.py │ │ │ ├── 02766-Relocate Marbles.py │ │ │ ├── 02767-Partition String Into Minimum Beautiful Substrings.py │ │ │ ├── 02768-Number of Black Blocks.py │ │ │ ├── 02779-Maximum Beauty of an Array After Applying Operation.py │ │ │ ├── 02810-Faulty Keyboard.py │ │ │ ├── 02841-Maximum Sum of Almost Unique Subarray.py │ │ │ ├── 02894-Divisible and Non-divisible Sums Difference.py │ │ │ ├── 02895-Minimum Processing Time.py │ │ │ ├── 02896-Apply Operations to Make Two Strings Equal.py │ │ │ ├── 02897-Apply Operations on Array to Maximize Sum of Squares.py │ │ │ ├── 02899-Last Visited Integers.py │ │ │ ├── 02900-Longest Unequal Adjacent Groups Subsequence I.py │ │ │ ├── 02902-Count of Sub-Multisets With Bounded Sum.py │ │ │ ├── 02903-Find Indices With Index and Value Difference I.py │ │ │ ├── 02904-Shortest and Lexicographically Smallest Beautiful String.py │ │ │ ├── 02906-Construct Product Matrix.py │ │ │ ├── 02942-Find Words Containing Character.py │ │ │ ├── 02943-Maximize Area of Square Hole in Grid.py │ │ │ ├── 02944-Minimum Number of Coins for Fruits.py │ │ │ ├── 02945-Find Maximum Non-decreasing Array Length.py │ │ │ ├── 02946-Matrix Similarity After Cyclic Shifts.py │ │ │ ├── 02947-Count Beautiful Substrings I.py │ │ │ ├── 02948-Make Lexicographically Smallest Array by Swapping Elements.py │ │ │ ├── 02949-Count Beautiful Substrings II.py │ │ │ ├── 02970-Count the Number of Incremovable Subarrays I.py │ │ │ ├── 02971-Find Polygon With the Largest Perimeter.py │ │ │ ├── 02972-Count the Number of Incremovable Subarrays II.py │ │ │ ├── 02973-Find Number of Coins to Place in Tree Nodes.py │ │ │ ├── 02974-Minimum Number Game.py │ │ │ ├── 02975-Maximum Square Area by Removing Fences From a Field.py │ │ │ ├── 02976-Minimum Cost to Convert String I.py │ │ │ ├── 02977-Minimum Cost to Convert String II.py │ │ │ ├── 02980-Check if Bitwise OR Has Trailing Zeros.py │ │ │ ├── 02981-Find Longest Special Substring That Occurs Thrice I.py │ │ │ ├── 02982-Find Longest Special Substring That Occurs Thrice II.py │ │ │ └── 03019-Number of Changing Keys.py │ │ ├── 3000 │ │ │ ├── 03020-Find the Maximum Number of Elements in Subset.py │ │ │ ├── 03021-Alice and Bob Playing Flower Game.py │ │ │ ├── 03022-Minimize OR of Remaining Elements Using Operations.py │ │ │ ├── 03046-Split the Array.py │ │ │ ├── 03047-Find the Largest Area of Square Inside Two Rectangles.py │ │ │ ├── 03048-Earliest Second to Mark Indices I.py │ │ │ ├── 03049-Earliest Second to Mark Indices II.py │ │ │ ├── 03065-Minimum Operations to Exceed Threshold Value I.py │ │ │ ├── 03067-Count Pairs of Connectable Servers in a Weighted Tree Network.py │ │ │ ├── 03069-Distribute Elements Into Two Arrays I.py │ │ │ ├── 03070-Count Submatrices with Top-Left Element and Sum Less Than k.py │ │ │ ├── 03075-Maximize Happiness of Selected Children.py │ │ │ ├── 03079-Find the Sum of Encrypted Integers.py │ │ │ ├── 03081-Replace Question Marks in String to Minimize Its Value.py │ │ │ ├── 03082-Find the Sum of the Power of All Subsequences.py │ │ │ ├── 03083-Existence of a Substring in a String and Its Reverse.py │ │ │ ├── 03084-Count Substrings Starting and Ending with Given Character.py │ │ │ ├── 03085-Minimum Deletions to Make String K-Special.py │ │ │ ├── 03090-Maximum Length Substring With Two Occurrences.py │ │ │ ├── 03091-Apply Operations to Make Sum of Array Greater Than or Equal to k.py │ │ │ ├── 03093-Longest Common Suffix Queries.py │ │ │ ├── 03095-Shortest Subarray With OR at Least K I.py │ │ │ ├── 03096-Minimum Levels to Gain More Points.py │ │ │ ├── 03097-Shortest Subarray With OR at Least K II.py │ │ │ ├── 03099-Harshad Number.py │ │ │ ├── 03100-Water Bottles II.py │ │ │ ├── 03101-Count Alternating Subarrays.py │ │ │ ├── 03142-Check if Grid Satisfies Conditions.py │ │ │ ├── 03143-Maximum Points Inside the Square.py │ │ │ ├── 03144-Minimum Substring Partition of Equal Character Frequency.py │ │ │ ├── 03145-Find Products of Elements of Big Array.py │ │ │ ├── 03146-Permutation Difference between Two Strings.py │ │ │ ├── 03147-Taking Maximum Energy From the Mystic Dungeon.py │ │ │ ├── 03148-Maximum Difference Score in a Grid.py │ │ │ ├── 03151-Special Array I.py │ │ │ ├── 03152-Special Array II.py │ │ │ ├── 03153-Sum of Digit Differences of All Pairs.py │ │ │ ├── 03168-Minimum Number of Chairs in a Waiting Room.py │ │ │ ├── 03169-Count Days Without Meetings.py │ │ │ ├── 03170-Lexicographically Minimum String After Removing Stars.py │ │ │ ├── 03200-Maximum Height of a Triangle.py │ │ │ ├── 03201-Find the Maximum Length of Valid Subsequence I.py │ │ │ ├── 03202-Find the Maximum Length of Valid Subsequence II.py │ │ │ ├── 03203-Find Minimum Diameter After Merging Two Trees.py │ │ │ ├── 03254-Find the Power of K-Size Subarrays I.py │ │ │ ├── 03255-Find the Power of K-Size Subarrays II.py │ │ │ ├── 03256-Maximum Value Sum by Placing Three Rooks I.py │ │ │ ├── 03257-Maximum Value Sum by Placing Three Rooks II.py │ │ │ ├── 03270-Find the Key of the Numbers.py │ │ │ ├── 03271-Hash Divided String.py │ │ │ ├── 03273-Minimum Amount of Damage Dealt to Bob.py │ │ │ ├── 03274-Check if Two Chessboard Squares Have the Same Color.py │ │ │ ├── 03276-Select Cells in Grid With Maximum Score.py │ │ │ ├── 03300-Minimum Element After Replacement With Digit Sum.py │ │ │ ├── 03301-Maximize the Total Height of Unique Towers.py │ │ │ ├── 03302-Find the Lexicographically Smallest Valid Sequence.py │ │ │ ├── 03303-Find the Occurrence of First Almost Equal Substring.py │ │ │ ├── 03314-Construct the Minimum Bitwise Array I.py │ │ │ ├── 03315-Construct the Minimum Bitwise Array II.py │ │ │ ├── 03324-Find the Sequence of Strings Appeared on the Screen.py │ │ │ ├── 03325-Count Substrings With K-Frequency Characters I.py │ │ │ ├── 03326-Minimum Division Operations to Make Array Non Decreasing.py │ │ │ ├── 03327-Check if DFS Strings Are Palindromes.py │ │ │ ├── 03364-Minimum Positive Sum Subarray.py │ │ │ ├── 03366-Minimum Array Sum.py │ │ │ ├── 03367-Maximize Sum of Weights after Edge Removals.py │ │ │ ├── 03370-Smallest Number With All Set Bits.py │ │ │ ├── 03371-Identify the Largest Outlier in an Array.py │ │ │ ├── 03373-Maximize the Number of Target Nodes After Connecting Trees II.py │ │ │ ├── 03452-Sum of Good Numbers.py │ │ │ ├── 03453-Separate Squares I.py │ │ │ ├── 03455-Shortest Matching Substring.py │ │ │ ├── 03477-Fruits Into Baskets II.py │ │ │ ├── 03480-Maximize Subarrays After Removing One Conflicting Pair.py │ │ │ ├── 03483-Unique 3-Digit Even Numbers.py │ │ │ ├── 03484-Design Spreadsheet.py │ │ │ ├── 03487-Maximum Unique Subarray Sum After Deletion.py │ │ │ ├── 03488-Closest Equal Element Queries.py │ │ │ ├── 03489-Zero Array Transformation IV.py │ │ │ ├── 03490-Count Beautiful Numbers.py │ │ │ ├── 03492-Maximum Containers on a Ship.py │ │ │ ├── 03493-Properties Graph.py │ │ │ ├── 03498-Reverse Degree of a String.py │ │ │ ├── 03499-Maximize Active Section with Trade I.py │ │ │ ├── 03502-Minimum Cost to Reach Every Position.py │ │ │ └── 03503-Longest Palindrome After Substring Concatenation I.py │ │ └── 0000 │ │ │ ├── 00002-Add Two Numbers.py │ │ │ ├── 00003-Longest Substring Without Repeating Characters.py │ │ │ ├── 00011-Container With Most Water.py │ │ │ ├── 00015-3Sum.py │ │ │ ├── 00030-Substring with Concatenation of All Words.py │ │ │ ├── 00038-Count and Say.py │ │ │ ├── 00039-Combination Sum.py │ │ │ ├── 00040-Combination Sum II.py │ │ │ ├── 00041-First Missing Positive.py │ │ │ ├── 00049-Group Anagrams.py │ │ │ ├── 00053-Maximum Subarray.py │ │ │ ├── 00056-Merge Intervals.py │ │ │ ├── 00058-Length of Last Word.py │ │ │ ├── 00062-Unique Paths.py │ │ │ ├── 00067-Add Binary.py │ │ │ ├── 00068-Text Justification.py │ │ │ ├── 00070-Climbing Stairs.py │ │ │ ├── 00071-Simplify Path.py │ │ │ ├── 00072-Edit Distance.py │ │ │ ├── 00077-Combinations.py │ │ │ ├── 00081-Search in Rotated Sorted Array II.py │ │ │ ├── 00084-Largest Rectangle in Histogram.py │ │ │ ├── 00089-Gray Code.py │ │ │ ├── 00091-Decode Ways.py │ │ │ ├── 00102-Binary Tree Level Order Traversal.py │ │ │ ├── 00105-Construct Binary Tree from Preorder and Inorder Traversal.py │ │ │ ├── 00106-Construct Binary Tree from Inorder and Postorder Traversal.py │ │ │ ├── 00107-Binary Tree Level Order Traversal II.py │ │ │ ├── 00108-Convert Sorted Array to Binary Search Tree.py │ │ │ ├── 00109-Convert Sorted List to Binary Search Tree.py │ │ │ ├── 00110-Balanced Binary Tree.py │ │ │ ├── 00114-Flatten Binary Tree to Linked List.py │ │ │ ├── 00121-Best Time to Buy and Sell Stock.py │ │ │ ├── 00122-Best Time to Buy and Sell Stock II.py │ │ │ ├── 00124-Binary Tree Maximum Path Sum.py │ │ │ ├── 00125-Valid Palindrome.py │ │ │ ├── 00128-Longest Consecutive Sequence.py │ │ │ ├── 00133-Clone Graph.py │ │ │ ├── 00134-Gas Station.py │ │ │ ├── 00135-Candy.py │ │ │ ├── 00136-Single Number.py │ │ │ ├── 00138-Copy List with Random Pointer.py │ │ │ ├── 00139-Word Break.py │ │ │ ├── 00140-Word Break II.py │ │ │ ├── 001425-Constrained Subsequence Sum.py │ │ │ ├── 00145-Binary Tree Postorder Traversal.py │ │ │ ├── 00150-Evaluate Reverse Polish Notation.py │ │ │ ├── 00153-Find Minimum in Rotated Sorted Array.py │ │ │ ├── 00165-Compare Version Numbers.py │ │ │ ├── 00179-Largest Number.py │ │ │ ├── 00188-Best Time to Buy and Sell Stock IV.py │ │ │ ├── 00201-Bitwise AND of Numbers Range.py │ │ │ ├── 00202-Happy Number.py │ │ │ ├── 00205-Isomorphic Strings.py │ │ │ ├── 00213-House Robber II.py │ │ │ ├── 00214-Shortest Palindrome.py │ │ │ ├── 00216-Combination Sum III.py │ │ │ ├── 00220-Contains Duplicate III.py │ │ │ ├── 00222-Count Complete Tree Nodes.py │ │ │ ├── 00223-Rectangle Area.py │ │ │ ├── 00224-Basic Calculator.py │ │ │ ├── 00227-Basic Calculator II.py │ │ │ ├── 00228-Summary Ranges.py │ │ │ ├── 00229-Majority Element II.py │ │ │ ├── 00232-Implement Queue using Stacks.py │ │ │ ├── 00236-Lowest Common Ancestor of a Binary Tree.py │ │ │ ├── 00241-Different Ways to Add Parentheses.py │ │ │ ├── 00242-Valid Anagram.py │ │ │ ├── 00246-Strobogrammatic Number.py │ │ │ ├── 00247-Strobogrammatic Number II.py │ │ │ ├── 00248-Strobogrammatic Number III.py │ │ │ ├── 00251-Flatten 2D Vector.py │ │ │ ├── 00252-Meeting Rooms.py │ │ │ ├── 00254-Factor Combinations.py │ │ │ ├── 00256-Paint House.py │ │ │ ├── 00259-3Sum Smaller.py │ │ │ ├── 00261-Graph Valid Tree.py │ │ │ ├── 00266-Palindrome Permutation.py │ │ │ ├── 00267-Palindrome Permutation II.py │ │ │ ├── 00268-Missing Number.py │ │ │ ├── 00271-Encode and Decode Strings.py │ │ │ ├── 00273-Integer to English Words.py │ │ │ ├── 00276-Paint Fence.py │ │ │ ├── 00280-Wiggle Sort.py │ │ │ ├── 00282-Expression Add Operators.py │ │ │ ├── 00284-Peeking Iterator.py │ │ │ ├── 00285-Inorder Successor in BST.py │ │ │ ├── 00288-Unique Word Abbreviation.py │ │ │ ├── 00289-Game of Life.py │ │ │ ├── 00290-Word Pattern.py │ │ │ ├── 00291-Word Pattern II.py │ │ │ ├── 00292-Nim Game.py │ │ │ ├── 00293-Flip Game.py │ │ │ ├── 00294-Flip Game II.py │ │ │ ├── 00297-Serialize and Deserialize Binary Tree.py │ │ │ ├── 00298-Binary Tree Longest Consecutive Sequence.py │ │ │ ├── 00302-Smallest Rectangle Enclosing Black Pixels.py │ │ │ ├── 00309-Best Time to Buy and Sell Stock with Cooldown.py │ │ │ ├── 00310-Minimum Height Trees.py │ │ │ ├── 00311-Sparse Matrix Multiplication.py │ │ │ ├── 00314-Binary Tree Vertical Order Traversal.py │ │ │ ├── 00316-Remove Duplicate Letters.py │ │ │ ├── 00320-Generalized Abbreviation.py │ │ │ ├── 00325-Maximum Size Subarray Sum Equals k.py │ │ │ ├── 00326-Power of Three.py │ │ │ ├── 00333-Largest BST Subtree.py │ │ │ ├── 00335-Self Crossing.py │ │ │ ├── 00336-Palindrome Pairs.py │ │ │ ├── 00338-Counting Bits.py │ │ │ ├── 00339-Nested List Weight Sum.py │ │ │ ├── 00340-Longest Substring with At Most K Distinct Characters.py │ │ │ ├── 00343-Integer Break.py │ │ │ ├── 00346-Moving Average from Data Stream.py │ │ │ ├── 00347-Top K Frequent Elements.py │ │ │ ├── 00349-Intersection of Two Arrays.py │ │ │ ├── 00355-Design Twitter.py │ │ │ ├── 00356-Line Reflection.py │ │ │ ├── 00357-Count Numbers with Unique Digits.py │ │ │ ├── 00358-Rearrange String k Distance Apart.py │ │ │ ├── 00364-Nested List Weight Sum II.py │ │ │ ├── 00366-Find Leaves of Binary Tree.py │ │ │ ├── 00368-Largest Divisible Subset.py │ │ │ ├── 00369-Plus One Linked List.py │ │ │ ├── 00370-Range Addition.py │ │ │ ├── 00372-Super Pow.py │ │ │ ├── 00374-Guess Number Higher or Lower.py │ │ │ ├── 00376-Wiggle Subsequence.py │ │ │ ├── 00377-Combination Sum IV.py │ │ │ ├── 00378-Kth Smallest Element in a Sorted Matrix.py │ │ │ ├── 00379-Design Phone Directory.py │ │ │ ├── 00383-Ransom Note.py │ │ │ ├── 00384-Shuffle an Array.py │ │ │ ├── 00385-Mini Parser.py │ │ │ ├── 00387-First Unique Character in a String.py │ │ │ ├── 00388-Longest Absolute File Path.py │ │ │ ├── 00389-Find the Difference.py │ │ │ ├── 00390-Elimination Game.py │ │ │ ├── 00392-Is Subsequence.py │ │ │ ├── 00393-UTF-8 Validation.py │ │ │ ├── 00394-Decode String.py │ │ │ ├── 00396-Rotate Function.py │ │ │ ├── 00398-Random Pick Index.py │ │ │ ├── 00400-Nth Digit.py │ │ │ ├── 00401-Binary Watch.py │ │ │ ├── 00402-Remove K Digits.py │ │ │ ├── 00404-Sum of Left Leaves.py │ │ │ ├── 00408-Valid Word Abbreviation.py │ │ │ ├── 00409-Longest Palindrome.py │ │ │ ├── 00412-Fizz Buzz.py │ │ │ ├── 00419-Battleships in a Board.py │ │ │ ├── 00420-Strong Password Checker.py │ │ │ ├── 00421-Maximum XOR of Two Numbers in an Array.py │ │ │ ├── 00422-Valid Word Square.py │ │ │ ├── 00423-Reconstruct Original Digits from English.py │ │ │ ├── 00434-Number of Segments in a String.py │ │ │ ├── 00439-Ternary Expression Parser.py │ │ │ ├── 00440-K-th Smallest in Lexicographical Order.py │ │ │ ├── 00453-Minimum Moves to Equal Array Elements.py │ │ │ ├── 00459-Repeated Substring Pattern.py │ │ │ ├── 00461-Hamming Distance.py │ │ │ ├── 00462-Minimum Moves to Equal Array Elements II.py │ │ │ ├── 00466-Count The Repetitions.py │ │ │ ├── 00468-Validate IP Address.py │ │ │ ├── 00470-Implement Rand10() Using Rand7().py │ │ │ ├── 00476-Number Complement.py │ │ │ ├── 00478-Generate Random Point in a Circle.py │ │ │ ├── 00479-Largest Palindrome Product.py │ │ │ ├── 00481-Magical String.py │ │ │ ├── 00482-License Key Formatting.py │ │ │ ├── 00483-Smallest Good Base.py │ │ │ ├── 00484-Find Permutation.py │ │ │ ├── 00485-Max Consecutive Ones.py │ │ │ ├── 00486-Predict the Winner.py │ │ │ ├── 00487-Max Consecutive Ones II.py │ │ │ ├── 00488-Zuma Game.py │ │ │ ├── 00492-Construct the Rectangle.py │ │ │ ├── 00495-Teemo Attacking.py │ │ │ ├── 00500-Keyboard Row.py │ │ │ ├── 00504-Base 7.py │ │ │ ├── 00506-Relative Ranks.py │ │ │ ├── 00508-Most Frequent Subtree Sum.py │ │ │ ├── 00517-Super Washing Machines.py │ │ │ ├── 00518-Coin Change 2.py │ │ │ ├── 00519-Random Flip Matrix.py │ │ │ ├── 00520-Detect Capital.py │ │ │ ├── 00521-Longest Uncommon Subsequence I.py │ │ │ ├── 00522-Longest Uncommon Subsequence II.py │ │ │ ├── 00523-Continuous Subarray Sum.py │ │ │ ├── 00525-Contiguous Array.py │ │ │ ├── 00527-Word Abbreviation.py │ │ │ ├── 00531-Lonely Pixel I.py │ │ │ ├── 00532-K-diff Pairs in an Array.py │ │ │ ├── 00533-Lonely Pixel II.py │ │ │ ├── 00535-Encode and Decode TinyURL.py │ │ │ ├── 00536-Construct Binary Tree from String.py │ │ │ ├── 00538-Convert BST to Greater Tree.py │ │ │ ├── 00539-Minimum Time Difference.py │ │ │ ├── 00541-Reverse String II.py │ │ │ ├── 00543-Diameter of Binary Tree.py │ │ │ ├── 00544-Output Contest Matches.py │ │ │ ├── 00545-Boundary of Binary Tree.py │ │ │ ├── 00548-Split Array with Equal Sum.py │ │ │ ├── 00551-Student Attendance Record I.py │ │ │ ├── 00556-Next Greater Element III.py │ │ │ ├── 00557-Reverse Words in a String III.py │ │ │ ├── 00560-Subarray Sum Equals K.py │ │ │ ├── 00561-Array Partition I.py │ │ │ ├── 00563-Binary Tree Tilt.py │ │ │ ├── 00564-Find the Closest Palindrome.py │ │ │ ├── 00566-Reshape the Matrix.py │ │ │ ├── 00567-Permutation in String.py │ │ │ ├── 00575-Distribute Candies.py │ │ │ ├── 00581-Shortest Unsorted Continuous Subarray.py │ │ │ ├── 00582-Kill Process.py │ │ │ ├── 00588-Design In-Memory File System.py │ │ │ ├── 00591-Tag Validator.py │ │ │ ├── 00592-Fraction Addition and Subtraction.py │ │ │ ├── 00593-Valid Square.py │ │ │ ├── 00594-Longest Harmonious Subsequence.py │ │ │ ├── 00598-Range Addition II.py │ │ │ ├── 00599-Minimum Index Sum of Two Lists.py │ │ │ ├── 00604-Design Compressed String Iterator.py │ │ │ ├── 00605-Can Place Flowers.py │ │ │ ├── 00606-Construct String from Binary Tree.py │ │ │ ├── 00609-Find Duplicate File in System.py │ │ │ ├── 00611-Valid Triangle Number.py │ │ │ ├── 00616-Add Bold Tag in String.py │ │ │ ├── 00621-Task Scheduler.py │ │ │ ├── 00625-Minimum Factorization.py │ │ │ ├── 00628-Maximum Product of Three Numbers.py │ │ │ ├── 00631-Design Excel Sum Formula.py │ │ │ ├── 00635-Design Log Storage System.py │ │ │ ├── 00640-Solve the Equation.py │ │ │ ├── 00641-Design Circular Deque.py │ │ │ ├── 00643-Maximum Average Subarray I.py │ │ │ ├── 00646-Maximum Length of Pair Chain.py │ │ │ ├── 00648-Replace Words.py │ │ │ ├── 00649-Dota2 Senate.py │ │ │ ├── 00651-4 Keys Keyboard.py │ │ │ ├── 00659-Split Array into Consecutive Subsequences.py │ │ │ ├── 00660-Remove 9.py │ │ │ ├── 00662-Maximum Width of Binary Tree.py │ │ │ ├── 00663-Equal Tree Partition.py │ │ │ ├── 00665-Non-decreasing Array.py │ │ │ ├── 00666-Path Sum IV.py │ │ │ ├── 00667-Beautiful Arrangement II.py │ │ │ ├── 00668-Kth Smallest Number in Multiplication Table.py │ │ │ ├── 00670-Maximum Swap.py │ │ │ ├── 00672-Bulb Switcher II.py │ │ │ ├── 00673-Number of Longest Increasing Subsequence.py │ │ │ ├── 00674-Longest Continuous Increasing Subsequence.py │ │ │ ├── 00676-Implement Magic Dictionary.py │ │ │ ├── 00677-Map Sum Pairs.py │ │ │ ├── 00678-Valid Parenthesis String.py │ │ │ ├── 00679-24 Game.py │ │ │ ├── 00680-Valid Palindrome II.py │ │ │ ├── 00681-Next Closest Time.py │ │ │ ├── 00682-Baseball Game.py │ │ │ ├── 00689-Maximum Sum of 3 Non-Overlapping Subarrays.py │ │ │ ├── 00690-Employee Importance.py │ │ │ ├── 00692-Top K Frequent Words.py │ │ │ ├── 00693-Binary Number with Alternating Bits.py │ │ │ ├── 00696-Count Binary Substrings.py │ │ │ ├── 00697-Degree of an Array.py │ │ │ ├── 00700-Search in a Binary Search Tree.py │ │ │ ├── 00701-Insert into a Binary Search Tree.py │ │ │ ├── 00704-Binary Search.py │ │ │ ├── 00705-Design HashSet.py │ │ │ ├── 00706-Design HashMap.py │ │ │ ├── 00707-Design Linked List.py │ │ │ ├── 00709-To Lower Case.py │ │ │ ├── 00718-Maximum Length of Repeated Subarray.py │ │ │ ├── 00722-Remove Comments.py │ │ │ ├── 00724-Find Pivot Index.py │ │ │ ├── 00725-Split Linked List in Parts.py │ │ │ ├── 00726-Number of Atoms.py │ │ │ ├── 00728-Self Dividing Numbers.py │ │ │ ├── 00729-My Calendar I.py │ │ │ ├── 00733-Flood Fill.py │ │ │ ├── 00734-Sentence Similarity.py │ │ │ ├── 00735-Asteroid Collision.py │ │ │ ├── 00736-Parse Lisp Expression.py │ │ │ ├── 00737-Sentence Similarity II.py │ │ │ ├── 00738-Monotone Increasing Digits.py │ │ │ ├── 00740-Delete and Earn.py │ │ │ ├── 00742-Closest Leaf in a Binary Tree.py │ │ │ ├── 00744-Find Smallest Letter Greater Than Target.py │ │ │ ├── 00745-Prefix and Suffix Search.py │ │ │ ├── 00746-Min Cost Climbing Stairs.py │ │ │ ├── 00747-Largest Number At Least Twice of Others.py │ │ │ ├── 00748-Shortest Completing Word.py │ │ │ ├── 00750-Number Of Corner Rectangles.py │ │ │ ├── 00754-Reach a Number.py │ │ │ ├── 00756-Pyramid Transition Matrix.py │ │ │ ├── 00760-Find Anagram Mappings.py │ │ │ ├── 00761-Special Binary String.py │ │ │ ├── 00762-Prime Number of Set Bits in Binary Representation.py │ │ │ ├── 00763-Partition Labels.py │ │ │ ├── 00765-Couples Holding Hands.py │ │ │ ├── 00770-Basic Calculator IV.py │ │ │ ├── 00771-Jewels and Stones.py │ │ │ ├── 00772-Basic Calculator III.py │ │ │ ├── 00774-Minimize Max Distance to Gas Station.py │ │ │ ├── 00780-Reaching Points.py │ │ │ ├── 00781-Rabbits in Forest.py │ │ │ ├── 00782-Transform to Chessboard.py │ │ │ ├── 00784-Letter Case Permutation.py │ │ │ ├── 00788-Rotated Digits.py │ │ │ ├── 00789-Escape The Ghosts.py │ │ │ ├── 00791-Custom Sort String.py │ │ │ ├── 00792-Number of Matching Subsequences.py │ │ │ ├── 00793-Preimage Size of Factorial Zeroes Function.py │ │ │ ├── 00796-Rotate String.py │ │ │ ├── 00798-Smallest Rotation with Highest Score.py │ │ │ ├── 00799-Champagne Tower.py │ │ │ ├── 00800-Similar RGB Color.py │ │ │ ├── 00801-Minimum Swaps To Make Sequences Increasing.py │ │ │ ├── 00802-Find Eventual Safe States.py │ │ │ ├── 00804-Unique Morse Code Words.py │ │ │ ├── 00805-Split Array With Same Average.py │ │ │ ├── 00806-Number of Lines To Write String.py │ │ │ ├── 00807-Max Increase to Keep City Skyline.py │ │ │ ├── 00808-Soup Servings.py │ │ │ ├── 00809-Expressive Words.py │ │ │ ├── 00810-Chalkboard XOR Game.py │ │ │ ├── 00811-Subdomain Visit Count.py │ │ │ ├── 00812-Largest Triangle Area.py │ │ │ ├── 00816-Ambiguous Coordinates.py │ │ │ ├── 00817-Linked List Components.py │ │ │ ├── 00818-Race Car.py │ │ │ ├── 00819-Most Common Word.py │ │ │ ├── 00820-Short Encoding of Words.py │ │ │ ├── 00821-Shortest Distance to a Character.py │ │ │ ├── 00822-Card Flipping Game.py │ │ │ ├── 00823-Binary Trees With Factors.py │ │ │ ├── 00826-Most Profit Assigning Work.py │ │ │ ├── 00830-Positions of Large Groups.py │ │ │ ├── 00831-Masking Personal Information.py │ │ │ ├── 00833-Find And Replace in String.py │ │ │ ├── 00835-Image Overlap.py │ │ │ ├── 00836-Rectangle Overlap.py │ │ │ ├── 00837-New 21 Game.py │ │ │ ├── 00838-Push Dominoes.py │ │ │ ├── 00841-Keys and Rooms.py │ │ │ ├── 00843-Guess the Word.py │ │ │ ├── 00845-Longest Mountain in Array.py │ │ │ ├── 00846-Hand of Straights.py │ │ │ ├── 00852-Peak Index in a Mountain Array.py │ │ │ ├── 00853-Car Fleet.py │ │ │ ├── 00854-K-Similar Strings.py │ │ │ ├── 00856-Score of Parentheses.py │ │ │ ├── 00857-Minimum Cost to Hire K Workers.py │ │ │ ├── 00858-Mirror Reflection.py │ │ │ ├── 00859-Buddy Strings.py │ │ │ ├── 00860-Lemonade Change.py │ │ │ ├── 00866-Prime Palindrome.py │ │ │ ├── 00868-Binary Gap.py │ │ │ ├── 00869-Reordered Power of 2.py │ │ │ ├── 00870-Advantage Shuffle.py │ │ │ ├── 00871-Minimum Number of Refueling Stops.py │ │ │ ├── 00872-Leaf-Similar Trees.py │ │ │ ├── 00876-Middle of the Linked List.py │ │ │ ├── 00877-Stone Game.py │ │ │ ├── 00878-Nth Magical Number.py │ │ │ ├── 00880-Decoded String at Index.py │ │ │ ├── 00883-Projection Area of 3D Shapes.py │ │ │ ├── 00884-Uncommon Words from Two Sentences.py │ │ │ ├── 00887-Super Egg Drop.py │ │ │ ├── 00888-Fair Candy Swap.py │ │ │ ├── 00889-Construct Binary Tree from Preorder and Postorder Traversal.py │ │ │ ├── 00890-Find and Replace Pattern.py │ │ │ ├── 00891-Sum of Subsequence Widths.py │ │ │ ├── 00892-Surface Area of 3D Shapes.py │ │ │ ├── 00893-Groups of Special-Equivalent Strings.py │ │ │ ├── 00894-All Possible Full Binary Trees.py │ │ │ ├── 00896-Monotonic Array.py │ │ │ ├── 00897-Increasing Order Search Tree.py │ │ │ ├── 00898-Bitwise ORs of Subarrays.py │ │ │ ├── 00899-Orderly Queue.py │ │ │ ├── 00902-Numbers At Most N Given Digit Set.py │ │ │ ├── 00904-Fruit Into Baskets.py │ │ │ ├── 00905-Sort Array By Parity.py │ │ │ ├── 00906-Super Palindromes.py │ │ │ ├── 00907-Sum of Subarray Minimums.py │ │ │ ├── 00908-Smallest Range I.py │ │ │ ├── 00909-Snakes and Ladders.py │ │ │ ├── 00910-Smallest Range II.py │ │ │ ├── 00911-Online Election.py │ │ │ ├── 00914-X of a Kind in a Deck of Cards.py │ │ │ ├── 00916-Word Subsets.py │ │ │ ├── 00917-Reverse Only Letters.py │ │ │ ├── 00918-Maximum Sum Circular Subarray.py │ │ │ ├── 00919-Complete Binary Tree Inserter.py │ │ │ ├── 00920-Number of Music Playlists.py │ │ │ ├── 00921-Minimum Add to Make Parentheses Valid.py │ │ │ ├── 00922-Sort Array By Parity II.py │ │ │ ├── 00925-Long Pressed Name.py │ │ │ ├── 00926-Flip String to Monotone Increasing.py │ │ │ ├── 00927-Three Equal Parts.py │ │ │ ├── 00928-Minimize Malware Spread II.py │ │ │ ├── 00929-Unique Email Addresses.py │ │ │ ├── 00930-Binary Subarrays With Sum.py │ │ │ ├── 00931-Minimum Falling Path Sum.py │ │ │ ├── 00932-Beautiful Array.py │ │ │ ├── 00933-Number of Recent Calls.py │ │ │ ├── 00934-Shortest Bridge.py │ │ │ ├── 00935-Knight Dialer.py │ │ │ ├── 00939-Minimum Area Rectangle.py │ │ │ ├── 00940-Distinct Subsequences II.py │ │ │ ├── 00941-Valid Mountain Array.py │ │ │ ├── 00942-DI String Match.py │ │ │ ├── 00944-Delete Columns to Make Sorted.py │ │ │ ├── 00945-Minimum Increment to Make Array Unique.py │ │ │ ├── 00946-Validate Stack Sequences.py │ │ │ ├── 00948-Bag of Tokens.py │ │ │ ├── 00953-Verifying an Alien Dictionary.py │ │ │ ├── 00954-Array of Doubled Pairs.py │ │ │ ├── 00955-Delete Columns to Make Sorted II.py │ │ │ ├── 00956-Tallest Billboard.py │ │ │ ├── 00957-Prison Cells After N Days.py │ │ │ ├── 00958-Check Completeness of a Binary Tree.py │ │ │ ├── 00959-Regions Cut By Slashes.py │ │ │ ├── 00961-N-Repeated Element in Size 2N Array.py │ │ │ ├── 00962-Maximum Width Ramp.py │ │ │ ├── 00963-Minimum Area Rectangle II.py │ │ │ ├── 00965-Univalued Binary Tree.py │ │ │ ├── 00966-Vowel Spellchecker.py │ │ │ ├── 00967-Numbers With Same Consecutive Differences.py │ │ │ ├── 00968-Binary Tree Cameras.py │ │ │ ├── 00969-Pancake Sorting.py │ │ │ ├── 00971-Flip Binary Tree To Match Preorder Traversal.py │ │ │ ├── 00972-Equal Rational Numbers.py │ │ │ ├── 00973-K Closest Points to Origin.py │ │ │ ├── 00974-Subarray Sums Divisible by K.py │ │ │ ├── 00976-Largest Perimeter Triangle.py │ │ │ ├── 00977-Squares of a Sorted Array.py │ │ │ ├── 00978-Longest Turbulent Subarray.py │ │ │ ├── 00979-Distribute Coins in Binary Tree.py │ │ │ ├── 00982-Triples with Bitwise AND Equal To Zero.py │ │ │ ├── 00983-Minimum Cost For Tickets.py │ │ │ ├── 00985-Sum of Even Numbers After Queries.py │ │ │ ├── 00986-Interval List Intersections.py │ │ │ ├── 00987-Vertical Order Traversal of a Binary Tree.py │ │ │ ├── 00988-Smallest String Starting From Leaf.py │ │ │ ├── 00989-Add to Array-Form of Integer.py │ │ │ ├── 00990-Satisfiability of Equality Equations.py │ │ │ ├── 00991-Broken Calculator.py │ │ │ ├── 00992-Subarrays with K Different Integers.py │ │ │ ├── 00993-Cousins in Binary Tree.py │ │ │ ├── 00994-Rotting Oranges.py │ │ │ ├── 00995-Minimum Number of K Consecutive Bit Flips.py │ │ │ ├── 00997-Find the Town Judge.py │ │ │ ├── 00998-Maximum Binary Tree II.py │ │ │ └── 00999-Available Captures for Rook.py │ └── swift │ │ ├── 00263-Ugly Number.swift │ │ └── 00274-H-Index.swift ├── Concurrency │ ├── Building H2O.cc │ ├── Fizz Buzz Multithreaded.cc │ ├── Print FooBar Alternately.cc │ ├── Print Zero Even Odd.cc │ ├── Print in Order.cc │ └── The Dining Philosophers.cc ├── Database │ ├── Combine Two Tables.sql │ ├── Duplicate Emails.sql │ ├── Not Boring Movies.sql │ ├── Nth Highest Salary.sql │ ├── Rising Temperature.sql │ └── Second Highest Salary.sql └── Shell │ ├── 00192-Word Frequency.bash │ └── 00195-Tenth Line.bash ├── LibreOj └── 10144.cc ├── LightOJ ├── 1027.cc ├── 1030.cc ├── 1038.cc ├── 1074.cc ├── 1079.cc ├── 1104.cc ├── 1151.cc ├── 1248.cc ├── 1265.cc ├── 1274.cc ├── 1284.cc ├── 1287.cc ├── 1317.cc ├── 1321.cc ├── 1342.cc ├── 1364.cc ├── 1370.cc ├── 1395.cc ├── 1408.cc └── 1422.cc ├── LineCounter.py ├── LintCode ├── cpp │ ├── 147 · Narcissistic Number.cc │ ├── 2 Sum.cc │ ├── 3 Sum Closest.cc │ ├── 3 Sum.cc │ ├── 4 Sum.cc │ ├── 8 · Rotate String.cc │ ├── A + B Problem.cc │ ├── Add Binary.cc │ ├── Add and Search Word.cc │ ├── Anagrams.cc │ ├── Assignment Operator Overloading (C++ Only).cc │ ├── Backpack II.cc │ ├── Backpack.cc │ ├── Balanced Binary Tree.cc │ ├── Best Time to Buy and Sell Stock II.cc │ ├── Best Time to Buy and Sell Stock III.cc │ ├── Best Time to Buy and Sell Stock.cc │ ├── Big Integer Addition.cc │ ├── Binary Search Tree Iterator.cc │ ├── Binary Search.cc │ ├── Binary Tree Inorder Traversal.cc │ ├── Binary Tree Level Order Traversal II.cc │ ├── Binary Tree Level Order Traversal.cc │ ├── Binary Tree Maximum Path Sum.cc │ ├── Binary Tree Paths.cc │ ├── Binary Tree Preorder Traversal.cc │ ├── Binary Tree Zigzag Level Order Traversal.cc │ ├── Building Outline.cc │ ├── Candy.cc │ ├── Climbing Stairs.cc │ ├── Clone Graph.cc │ ├── Coins in a Line II.cc │ ├── Coins in a Line III.cc │ ├── Coins in a Line.cc │ ├── Combination Sum II.cc │ ├── Combination Sum.cc │ ├── Combinations.cc │ ├── Compare Strings.cc │ ├── Construct Binary Tree from Preorder and Inorder Traversal.cc │ ├── Container With Most Water.cc │ ├── Continuous Subarray Sum II.cc │ ├── Continuous Subarray Sum.cc │ ├── Convert Integer A to Integer B.cc │ ├── Convert Sorted Array to Binary Search Tree With Minimal Height.cc │ ├── Convert Sorted List to Binary Search Tree.cc │ ├── Copy Books.py │ ├── Copy List with Random Pointer.cc │ ├── Count 1 in Binary.cc │ ├── Count of Smaller Number before itself.cc │ ├── Count of Smaller Number.cc │ ├── Delete Digits.cc │ ├── Delete Node in the Middle of Singly Linked List.cc │ ├── Digit Counts.cc │ ├── Distinct Subsequences.cc │ ├── Divide Two Integers.cc │ ├── Edit Distance.cc │ ├── Expression Evaluation.cc │ ├── Expression Tree Build.cc │ ├── Fast Power.cc │ ├── Fibonacci.cc │ ├── Find Peak Element II.cc │ ├── Find Peak Element.cc │ ├── Find the Connected Component in the Undirected Graph.cc │ ├── Find the Missing Number.cc │ ├── Find the Weak Connected Component in the Directed Graph.cc │ ├── First Bad Version.cc │ ├── First Missing Positive.cc │ ├── Fizz Buzz.cc │ ├── Flatten Binary Tree to Linked List.cc │ ├── Gas Station.cc │ ├── Generate Parentheses.cc │ ├── Graph Valid Tree.cc │ ├── Gray Code.cc │ ├── Hash Function.cc │ ├── Heapify.cc │ ├── House Robber.cc │ ├── Implement Iterator of Binary Search Tree.cc │ ├── Implement Queue by Two Stacks.cc │ ├── Insert Interval.cc │ ├── Insert Node in a Binary Search Tree.cc │ ├── Insertion Sort List.cc │ ├── Interleaving Positive and Negative Numbers.cc │ ├── Interleaving String.cc │ ├── Intersection of Two Linked Lists.cc │ ├── Interval Minimum Number.cc │ ├── Interval Sum II.cc │ ├── Interval Sum.cc │ ├── Jump Game II.cc │ ├── Jump Game.cc │ ├── Kth Largest Element.cc │ ├── Kth Smallest Number in Sorted Matrix.cc │ ├── LFU Cache.cc │ ├── LRU Cache.cc │ ├── Largest Number.cc │ ├── Largest Rectangle in Histogram.cc │ ├── Linked List Cycle II.cc │ ├── Linked List Cycle.cc │ ├── Longest Common Prefix.cc │ ├── Longest Common Subsequence.cc │ ├── Longest Common Substring.cc │ ├── Longest Consecutive Sequence.cc │ ├── Longest Increasing Continuous subsequence II.cc │ ├── Longest Increasing Continuous subsequence.cc │ ├── Longest Increasing Subsequence.cc │ ├── Longest Palindromic Substring.cc │ ├── Longest Substring Without Repeating Characters.cc │ ├── Longest Substring with At Most K Distinct Characters.cc │ ├── Lowest Common Ancestor.cc │ ├── Majority Number II.cc │ ├── Majority Number III.cc │ ├── Majority Number.cc │ ├── Matrix Zigzag Traversal.cc │ ├── Max Tree.cc │ ├── Maximal Square.cc │ ├── Maximum Depth of Binary Tree.cc │ ├── Maximum Gap.cc │ ├── Maximum Product Subarray.cc │ ├── Maximum Subarray Difference.cc │ ├── Maximum Subarray II.cc │ ├── Maximum Subarray III.cc │ ├── Maximum Subarray.cc │ ├── Median II.cc │ ├── Median.cc │ ├── Merge Intervals.cc │ ├── Merge Sorted Array.cc │ ├── Merge Two Sorted Lists.cc │ ├── Merge k Sorted Lists.cc │ ├── Min Stack.cc │ ├── Minimum Adjustment Cost.cc │ ├── Minimum Depth of Binary Tree.cc │ ├── Minimum Partition.cc │ ├── Minimum Path Sum.cc │ ├── Minimum Risk Path.cc │ ├── Minimum Size Subarray Sum.cc │ ├── Minimum Subarray.cc │ ├── Minimum Window Substring.cc │ ├── Movie Network.cc │ ├── N-Queens II.cc │ ├── N-Queens.cc │ ├── Next Permutation II.cc │ ├── Next Permutation.cc │ ├── Nth to Last Node in List.cc │ ├── Number of Airplanes in the Sky.cc │ ├── Number of Islands II.cc │ ├── Number of Islands.cc │ ├── O(1) Check Power of 2.cc │ ├── Palindrome Linked List.cc │ ├── Palindrome Partitioning.cc │ ├── Partition Array by Odd and Even.cc │ ├── Partition Array.cc │ ├── Partition List.cc │ ├── Permutation Index.cc │ ├── Permutation Sequence.cc │ ├── Plus One.cc │ ├── Pow(x, n).cc │ ├── Previous Permuation.cc │ ├── Recover Rotated Sorted Array.cc │ ├── Regular Expression Matching.cc │ ├── Rehashing.cc │ ├── Remove Duplicates from Sorted Array.cc │ ├── Remove Duplicates from Sorted List II.cc │ ├── Remove Duplicates from Sorted List.cc │ ├── Remove Element Show.cc │ ├── Remove Linked List Elements.cc │ ├── Remove Node in Binary Search Tree.cc │ ├── Remove Nth Node From End of List.cc │ ├── Reorder List.cc │ ├── Restore IP Addresses.cc │ ├── Reverse Integer.cc │ ├── Reverse Linked List II.cc │ ├── Reverse Linked List.cc │ ├── Rotate Image.cc │ ├── Rotate List.cc │ ├── Route Between Two Nodes in Graph.cc │ ├── Russian Doll Envelopes.cc │ ├── Search Insert Position.cc │ ├── Search a 2D Matrix II.cc │ ├── Search a 2D Matrix.cc │ ├── Search for a Range.cc │ ├── Segment Tree Build.cc │ ├── Segment Tree Query II.cc │ ├── Segment Tree Query.cc │ ├── Set Matrix Zeroes.cc │ ├── Single Number II.cc │ ├── Single Number III.cc │ ├── Singleton.cc │ ├── Sliding Window Maximum.cc │ ├── Sliding Window Unique Elements Sum.cc │ ├── Sort Colors II.cc │ ├── Sort Colors.cc │ ├── Sort Letters by Case.cc │ ├── Sort List.cc │ ├── Space Replacement.cc │ ├── Sqrt(x).cc │ ├── Subarray Sum Closest.cc │ ├── Subarray Sum II.cc │ ├── Subarray Sum.cc │ ├── Subsets II.cc │ ├── Subsets.cc │ ├── Subtree.cc │ ├── Swap Nodes in Pairs.cc │ ├── The Smallest Difference.cc │ ├── Time Intersection.cc │ ├── Topological Sorting.cc │ ├── Trapping Rain Water II.cc │ ├── Trapping Rain Water.cc │ ├── Tree Longest Path With Same Value.cc │ ├── Triangle Count.cc │ ├── Triangle.cc │ ├── Two Lists Sum.cc │ ├── Ugly Number.cc │ ├── Unique Binary Search Trees II.cc │ ├── Unique Binary Search Trees.cc │ ├── Unique Characters.cc │ ├── Unique Paths.cc │ ├── Unique Subsets.cc │ ├── Update Bits.cc │ ├── Valid Number.cc │ ├── Valid Sudoku.cc │ ├── Validate Binary Search Tree.cc │ ├── Wood Cut.cc │ ├── Word Ladder.cc │ ├── Word Search.cc │ └── Word Segmentation.cc ├── java │ ├── Binary Search.java │ ├── Find Peak Element II.java │ ├── Find Peak Element.java │ ├── Find a Peak.java │ ├── Linked List Cycle II.java │ ├── Longest Common Substring.java │ ├── Lowest Common Ancestor.java │ └── Max Tree.java └── python │ ├── 2416 · N threads to achieve quick sort.py │ ├── 2442 · Print ABC interleavly.py │ ├── 2444 · 3 threads to print n groups.py │ ├── 2450 · Start the thread to print hello world.py │ ├── 2496 · 4 threads modify the same variable.py │ ├── 2497 · Deposit and Withdraw Money.py │ ├── 82 · Single Number.py │ ├── Binary Representation.py │ ├── Binary Time.py │ ├── Binary Tree Serialization.py │ ├── Bus Station.py │ ├── Buy Fruits.py │ ├── Calculate Maximum Value II.py │ ├── Check Sum of K Primes.py │ ├── Check Sum of Square Numbers.py │ ├── Coin Change II.py │ ├── Computer Maintenance.py │ ├── Cosine Similarity.py │ ├── Count and Say.py │ ├── Dices Sum.py │ ├── Digit Divide Numbers.py │ ├── Factorial.py │ ├── Find Minimum in Rotated Sorted Array II.py │ ├── Happy Number.py │ ├── Hex Conversion.py │ ├── House Robber.py │ ├── Input Stream.py │ ├── Invert Binary Tree.py │ ├── Kth Prime Number.py │ ├── Length of Last Word.py │ ├── Letter Combinations of a Phone Number.py │ ├── Longest Words.py │ ├── Maximum Product Subarray.py │ ├── Merge Number.py │ ├── Merge k Sorted Lists.py │ ├── Missing String.py │ ├── Monotone Increasing Digits.py │ ├── Palindrome Number II.py │ ├── Parser.py │ ├── Permutations II.py │ ├── Permutations.py │ ├── Print Numbers by Recursion.py │ ├── Rectangle.py │ ├── Reorder array to construct the minimum number.py │ ├── Reverse Words in a String.py │ ├── Rotate Words.cc │ ├── Simplify Path.py │ ├── Single Number IV.py │ ├── Split String.py │ ├── String to Integer(atoi).py │ ├── Subarray Sum II.py │ ├── Subset With Target.py │ ├── Top K Frequent Words.py │ ├── Two Strings Are Anagrams.py │ ├── Two Sum - Input array is sorted.py │ ├── Two Sum.py │ ├── Unique Characters.py │ ├── Valid Palindrome.py │ ├── Valid Parentheses.py │ ├── Valid Perfect Square.py │ ├── Word Sorting.py │ └── strStr.py ├── Luogu ├── B │ ├── B2002.rs │ ├── B2005.rs │ └── B2025.rs └── P │ ├── P1000.rs │ ├── P1001.rs │ ├── P1002.cc │ ├── P1004.cc │ ├── P1005.py │ ├── P1006.cc │ ├── P1009.py │ ├── P10177.py │ ├── P10178.cc │ ├── P1019.cc │ ├── P1020.cc │ ├── P1022.py │ ├── P1031.py │ ├── P1040.cc │ ├── P1044.py │ ├── P1052.cc │ ├── P1064.cc │ ├── P1069.py │ ├── P11019.py │ ├── P11020.py │ ├── P11021.cc │ ├── P1108.cc │ ├── P11227.go │ ├── P11228.go │ ├── P11229.cc │ ├── P11230.cc │ ├── P11231.cc │ ├── P11232.cc │ ├── P1124.cc │ ├── P11242.py │ ├── P11243.py │ ├── P11244.cc │ ├── P11246.py │ ├── P11271.go │ ├── P11272.py │ ├── P11273.py │ ├── P11274.cc │ ├── P1128.cc │ ├── P11308.py │ ├── P11309.py │ ├── P1131.cc │ ├── P11310.py │ ├── P1147.py │ ├── P1158.cc │ ├── P1198.cc │ ├── P1220.py │ ├── P1253.cc │ ├── P1272.cc │ ├── P1297.cc │ ├── P1308.cc │ ├── P1328.py │ ├── P1330.cc │ ├── P1347.py │ ├── P1352.cc │ ├── P1364.cc │ ├── P1419.py │ ├── P1453.cc │ ├── P1469.cc │ ├── P1471.cc │ ├── P1496.py │ ├── P1525.cc │ ├── P1591.py │ ├── P1597.py │ ├── P1613.cc │ ├── P1654.py │ ├── P1776.cc │ ├── P1801.cc │ ├── P1880.cc │ ├── P1908.py │ ├── P1941.cc │ ├── P1983.cc │ ├── P2016.cc │ ├── P2032.py │ ├── P2197.py │ ├── P2254.cc │ ├── P2539.cc │ ├── P2569.cc │ ├── P2585.cc │ ├── P2617.cc │ ├── P2822.cc │ ├── P2853.cc │ ├── P2986.cc │ ├── P3052.cc │ ├── P3067.cc │ ├── P3089.cc │ ├── P3143.py │ ├── P3304.cc │ ├── P3369.cc │ ├── P3372.cc │ ├── P3373.cc │ ├── P3388.cc │ ├── P3422.cc │ ├── P3423.cc │ ├── P3478.cc │ ├── P3487.cc │ ├── P3512.cc │ ├── P3522.cc │ ├── P3572.cc │ ├── P3694.cc │ ├── P3802.py │ ├── P3811.py │ ├── P3842.cc │ ├── P3868.py │ ├── P3870.cc │ ├── P4053.cc │ ├── P4059.cc │ ├── P4136.py │ ├── P4391.cc │ ├── P4544.cc │ ├── P4555.cc │ ├── P4933.cc │ ├── P5015.py │ ├── P5658.cc │ ├── P5858.cc │ ├── P5937.cc │ ├── P6153.py │ ├── P7106.py │ ├── P7107.py │ ├── P7108.cc │ ├── P7109.py │ ├── P7960.cc │ ├── P7961.cc │ ├── P7962.cc │ └── P8177.py ├── MeetCoder ├── 1.py ├── 40.cc └── 49.cc ├── NBUT └── 1525.cc ├── NKU OJ ├── 2182.cc ├── 2188.cc ├── 2189.java ├── 2190.cc ├── 2191.cc ├── 2192.cc ├── 2193.cc ├── 2194.cc ├── 2196.cc ├── 2210.cc ├── 2215.cc ├── 2216.cc ├── 2218.cc ├── 2219.cc ├── 2221.cc ├── 2222.cc ├── 2223.cc ├── 2342.cc ├── 2344.py ├── 2346.cc └── 2347.cc ├── Note ├── Basic Algorithms │ ├── Basic Algorithms.md │ └── DFS.md ├── Data Structures │ ├── Data Structures.md │ └── Tree.md ├── Dynamic Programming │ └── Dynamic Programming.md ├── Graph Theory │ ├── Disjont Set.md │ ├── Graph Theory.md │ ├── Graph Traversal.md │ ├── Solutions │ │ ├── CF-1787D Game on Axis.md │ │ └── Luogu-P5937 Parity Game.md │ ├── Tree Centroid.md │ └── Tree Diameter.md ├── Implementation.md ├── Index.md ├── Misc.md ├── Problem Solving │ ├── Greedy.md │ ├── Parity.md │ ├── Problem Solving.md │ └── Solutions │ │ ├── KickStart2022-F Scheduling a Meeting.md │ │ ├── KickStart2022-F Story of Seasons.md │ │ └── LC2747-Count Zero Request Servers.md └── String │ ├── Palindrome.md │ └── Solutions │ └── Luogu-P4555 最长双回文串.md ├── Nowcoder ├── 剑指Offer │ ├── README.md │ ├── 二叉搜索树的第k个结点.py │ ├── 二叉树的镜像.py │ ├── 二维数组中的查找.py │ ├── 二进制中1的个数,cc │ ├── 从尾到头打印链表.py │ ├── 包含min函数的栈.py │ ├── 反转链表.py │ ├── 变态跳台阶.py │ ├── 合并两个排序的链表.py │ ├── 序列化二叉树.py │ ├── 数值的整数次方.cc │ ├── 斐波那契数列.py │ ├── 旋转数组的最小数字.py │ ├── 替换空格.py │ ├── 树的子结构.py │ ├── 用两个栈实现队列.py │ ├── 矩形覆盖.py │ ├── 调整数组顺序使奇数位于偶数前面.py │ ├── 跳台阶.py │ ├── 重建二叉树.py │ ├── 链表中倒数第k个结点.py │ └── 顺时针打印矩阵.py ├── 牛客练习赛19 │ ├── A.cc │ ├── B.cc │ ├── C.cc │ ├── D.cc │ ├── E.py │ ├── F.py │ └── README.md ├── 牛客练习赛29 │ ├── A.cc │ ├── B.cc │ ├── F.cc │ └── README.md └── 第八届“图灵杯”NEUQ-ACM程序设计竞赛个人赛 │ ├── A.py │ ├── B.cc │ ├── C.cc │ ├── D.py │ ├── E.py │ ├── F.cc │ ├── G.py │ ├── H.py │ ├── I.py │ ├── J.cc │ ├── K.py │ └── L.py ├── OpenJudge ├── 1046.cc ├── 4132.py └── C22H.cc ├── POJ ├── 1 │ ├── 1000.cpp │ ├── 1001.java │ ├── 1002.cc │ ├── 1003.cpp │ ├── 1004.cpp │ ├── 1005.cc │ ├── 1006.cc │ ├── 1007.cpp │ ├── 1008.cc │ ├── 1011.cc │ ├── 1012.cpp │ ├── 1014.cc │ ├── 1017.cc │ ├── 1019.cc │ ├── 1023.cc │ ├── 1026.cc │ ├── 1027.cc │ ├── 1031.cc │ ├── 1035.cc │ ├── 1039.cc │ ├── 1041.cc │ ├── 1042.cc │ ├── 1054.cc │ ├── 1061.cc │ ├── 1062.cc │ ├── 1064.cc │ ├── 1066.cc │ ├── 1067.cc │ ├── 1068.cc │ ├── 1069.cc │ ├── 1080.cc │ ├── 1085.cc │ ├── 1087.cc │ ├── 1088.cc │ ├── 1091.cc │ ├── 1094.cc │ ├── 1095.cc │ ├── 1106.cc │ ├── 1113.cc │ ├── 1125.cc │ ├── 1129.cc │ ├── 1149.cc │ ├── 1151.cc │ ├── 1152.cc │ ├── 1159.cc │ ├── 1163.cpp │ ├── 1166.cc │ ├── 1182.cc │ ├── 1184.cc │ ├── 1185.cc │ ├── 1190.cc │ ├── 1191.cc │ ├── 1195.cc │ ├── 1200.cc │ ├── 1201.cc │ ├── 1207.cc │ ├── 1218.cpp │ ├── 1222.cc │ ├── 1226.cc │ ├── 1228.cc │ ├── 1236.cc │ ├── 1258.cc │ ├── 1260.cc │ ├── 1273.cc │ ├── 1274.cc │ ├── 1275.cc │ ├── 1276.cc │ ├── 1286.cc │ ├── 1298.cc │ ├── 1308.cc │ ├── 1321.cc │ ├── 1324.cc │ ├── 1325.cc │ ├── 1328.cc │ ├── 1330.cc │ ├── 1386.cc │ ├── 1408.cc │ ├── 1416.cc │ ├── 1426.cc │ ├── 1456.cc │ ├── 1458.cc │ ├── 1459.cc │ ├── 1469.cc │ ├── 1472.cc │ ├── 1474.cc │ ├── 1486.cc │ ├── 1487.cc │ ├── 1496.cc │ ├── 1503.cc │ ├── 1509.cc │ ├── 1511.cc │ ├── 1515.cc │ ├── 1521.cc │ ├── 1556.cc │ ├── 1562.cc │ ├── 1573.cc │ ├── 1579.cc │ ├── 1584.cc │ ├── 1639.cc │ ├── 1654.cc │ ├── 1655.cc │ ├── 1658.cc │ ├── 1659.cc │ ├── 1661.cc │ ├── 1664.cc │ ├── 1681.cc │ ├── 1686.cc │ ├── 1691.cc │ ├── 1699.cc │ ├── 1700.cc │ ├── 1703.cc │ ├── 1704.cc │ ├── 1716.cc │ ├── 1724.cc │ ├── 1730.cc │ ├── 1734.cc │ ├── 1743.cc │ ├── 1753.cc │ ├── 1765.cc │ ├── 1768.cc │ ├── 1769.cc │ ├── 1789.cc │ ├── 1804.cc │ ├── 1821.cc │ ├── 1823.cc │ ├── 1825.java │ ├── 1827.cc │ ├── 1830.cc │ ├── 1836.cc │ ├── 1837.cc │ ├── 1840.cc │ ├── 1845.cc │ ├── 1850.cc │ ├── 1852.cc │ ├── 1860.cc │ ├── 1870.cc │ ├── 1904.cc │ ├── 1905.cc │ ├── 1925.cc │ ├── 1936.cc │ ├── 1942.cc │ ├── 1947.cc │ ├── 1961.cc │ ├── 1979.cpp │ ├── 1985.cc │ └── 1988.cc ├── 2 │ ├── 2001.cc │ ├── 2002.cc │ ├── 2029.cc │ ├── 2031.cc │ ├── 2049.cc │ ├── 2057.cc │ ├── 2065.cc │ ├── 2079.cc │ ├── 2100.cc │ ├── 2104.cc │ ├── 2109.cpp │ ├── 2112.cc │ ├── 2115.cc │ ├── 2121.cc │ ├── 2135.cc │ ├── 2136.cc │ ├── 2151.cc │ ├── 2155.cc │ ├── 2159.cc │ ├── 2175.cc │ ├── 2185.cc │ ├── 2186.cc │ ├── 2187.cc │ ├── 2195.cc │ ├── 2226.cc │ ├── 2228.cc │ ├── 2240.cc │ ├── 2244.cc │ ├── 2249.cc │ ├── 2251.cc │ ├── 2253.cc │ ├── 2262.cpp │ ├── 2265.cc │ ├── 2271.cpp │ ├── 2273.cc │ ├── 2279.java │ ├── 2280.cc │ ├── 2287.cc │ ├── 2289.cc │ ├── 2296.cc │ ├── 2299.cc │ ├── 2311.cc │ ├── 2337.cc │ ├── 2342.cc │ ├── 2345.cc │ ├── 2352.cc │ ├── 2376.cc │ ├── 2386.cc │ ├── 2387.cc │ ├── 2388.cc │ ├── 2392.cc │ ├── 2393 .cc │ ├── 2400.cc │ ├── 2406.cc │ ├── 2409.cc │ ├── 2411.cc │ ├── 2418.cc │ ├── 2431.cc │ ├── 2441.cc │ ├── 2452.cc │ ├── 2454.cc │ ├── 2479.cc │ ├── 2482.cc │ ├── 2485.cc │ ├── 2486.cc │ ├── 2488.cc │ ├── 2492.cc │ ├── 2503.cc │ ├── 2505.cc │ ├── 2513.cc │ ├── 2516.cc │ ├── 2524.cc │ ├── 2528.cc │ ├── 2531.cc │ ├── 2533.cc │ ├── 2553.cc │ ├── 2559.cc │ ├── 2562.cc │ ├── 2566.cc │ ├── 2573.cc │ ├── 2584.cc │ ├── 2586.cc │ ├── 2593.cc │ ├── 2594.cc │ ├── 2611.cc │ ├── 2620.cc │ ├── 2623.cc │ ├── 2632.cc │ ├── 2635.cc │ ├── 2676.cc │ ├── 2686.cc │ ├── 2688.cc │ ├── 2706.cc │ ├── 2718.cc │ ├── 2723.cc │ ├── 2739.cc │ ├── 2744.cc │ ├── 2750.cc │ ├── 2752.cc │ ├── 2753.cc │ ├── 2761.cc │ ├── 2762.cc │ ├── 2774.cc │ ├── 2777.cc │ ├── 2778.cc │ ├── 2823.cc │ ├── 2826.cc │ ├── 2828.cc │ ├── 2836.cc │ ├── 2840.cc │ ├── 2886.cc │ ├── 2914.cc │ ├── 2932.cc │ ├── 2942.cc │ ├── 2948.cc │ ├── 2955.cc │ ├── 2965.cc │ ├── 2975.cc │ ├── 2976.cc │ ├── 2983.cc │ ├── 2986.cc │ ├── 2993.cc │ └── 2996.cc └── 3 │ ├── 3007.cc │ ├── 3009.cc │ ├── 3020.cc │ ├── 3026.cc │ ├── 3034.cc │ ├── 3040.cc │ ├── 3041.cc │ ├── 3050.cc │ ├── 3061.cc │ ├── 3069.cc │ ├── 3070.cc │ ├── 3071.cc │ ├── 3080.cc │ ├── 3083.cc │ ├── 3084.cc │ ├── 3087.cc │ ├── 3094.cpp │ ├── 3096.cc │ ├── 3101.cc │ ├── 3104.cc │ ├── 3122.cc │ ├── 3126.cc │ ├── 3130.cc │ ├── 3140.cc │ ├── 3150.cc │ ├── 3155.cc │ ├── 3157.cc │ ├── 3159.cc │ ├── 3164.cc │ ├── 3169.cc │ ├── 3171.cc │ ├── 3176.cc │ ├── 3185.cc │ ├── 3186.cc │ ├── 3187.cc │ ├── 3207.cc │ ├── 3211.cc │ ├── 3227.cc │ ├── 3233.cc │ ├── 3252.cc │ ├── 3253.cc │ ├── 3254.cc │ ├── 3255.cc │ ├── 3258.cc │ ├── 3259.cc │ ├── 3261.cc │ ├── 3264.cc │ ├── 3267.cc │ ├── 3270.cc │ ├── 3272.cc │ ├── 3273.cc │ ├── 3274.cc │ ├── 3275.cc │ ├── 3276.cc │ ├── 3277.cc │ ├── 3278.cc │ ├── 3280.cc │ ├── 3286.cc │ ├── 3292.cc │ ├── 3294.cc │ ├── 3295.cc │ ├── 3296.cc │ ├── 3301.cc │ ├── 3304.cc │ ├── 3308.cc │ ├── 3317.cc │ ├── 3318.cc │ ├── 3321.cc │ ├── 3335.cc │ ├── 3342.cc │ ├── 3345.cc │ ├── 3349.cc │ ├── 3352.cc │ ├── 3368.cc │ ├── 3371.cc │ ├── 3372.cc │ ├── 3373.cc │ ├── 3393.cc │ ├── 3404.cc │ ├── 3411.cc │ ├── 3414.cc │ ├── 3415.cc │ ├── 3420.cc │ ├── 3422.cc │ ├── 3434.cc │ ├── 3436.cc │ ├── 3440.cc │ ├── 3449.cc │ ├── 3463.cc │ ├── 3468.cc │ ├── 3469.cc │ ├── 3480.cc │ ├── 3481.cc │ ├── 3487.cc │ ├── 3494.cc │ ├── 3519.cc │ ├── 3557.cc │ ├── 3565.cc │ ├── 3579.cc │ ├── 3608.cc │ ├── 3616.cc │ ├── 3617.cc │ ├── 3630.cc │ ├── 3638.cc │ ├── 3648.cc │ ├── 3666.cc │ ├── 3667.cc │ ├── 3669.cc │ ├── 3675.cc │ ├── 3685.cc │ ├── 3686.cc │ ├── 3691.cc │ ├── 3696.cc │ ├── 3714.cc │ ├── 3723.cc │ ├── 3734.cc │ ├── 3735.cc │ ├── 3748.cc │ ├── 3749.cc │ ├── 3750.cc │ ├── 3751.cc │ ├── 3752.cc │ ├── 3761.cc │ ├── 3765.cc │ ├── 3767.cc │ ├── 3768.cc │ ├── 3771.cc │ ├── 3774.cc │ ├── 3781.cc │ ├── 3804.cc │ ├── 3805.cc │ ├── 3830.cc │ ├── 3905.cc │ ├── 3921.cc │ ├── 3923.cc │ ├── 3928.cc │ ├── 3959.cc │ ├── 3974.cc │ ├── 3980.cc │ └── 3981.cc ├── Project Euler ├── 0001.scala ├── 0002.scala ├── 0003.py ├── 0004.py ├── 0005.py ├── 0006.py ├── 0007.py ├── 0008.py ├── 0009.py ├── 0010.cc ├── 0011.cc ├── 0012.py ├── 0013.py ├── 0014.py ├── 0015.py ├── 0016.py ├── 0017.py ├── 0018.py ├── 0019.py ├── 0020.py ├── 0021.py ├── 0022.py ├── 0023.py ├── 0024.cc ├── 0025.py ├── 0026.py ├── 0027.py ├── 0028.py ├── 0029.py ├── 0030.py ├── 0031.py ├── 0032.cc ├── 0033.py ├── 0034.py ├── 0035.py ├── 0036.py ├── 0037.py ├── 0038.py ├── 0039.scala ├── 0040.scala ├── 0041.py ├── 0042.py ├── 0043.py ├── 0044.py ├── 0045.py ├── 0046.cc ├── 0047.cc ├── 0048.py ├── 0049.py ├── 0050.cs ├── 0051.py ├── 0052.py ├── 0053.py ├── 0054.py ├── 0055.py ├── 0056.py ├── 0057.py ├── 0058.py ├── 0059.py ├── 0060.py ├── 0061.py ├── 0062.py ├── 0063.py ├── 0064.py ├── 0065.py ├── 0066.py ├── 0067.py ├── 0068.py ├── 0069.py ├── 0070.py ├── 0071.py ├── 0072.py ├── 0073.py ├── 0074.py ├── 0075.py ├── 0076.cc ├── 0077.cc ├── 0078.cc ├── 0079.py ├── 0080.py └── utils │ ├── __init__.py │ └── prime │ ├── __init__.py │ ├── func.py │ └── primes1m.py ├── README.md ├── SGU ├── 206.cc ├── 275.cc ├── 510.cc ├── 523.cc └── 527.cc ├── SPOJ ├── 1.hs ├── 11.cc ├── 2.cc ├── 412.cc ├── 42.py ├── AMR11A.cc ├── BALNUM.cc ├── DNALAB.cc ├── EPALIN.py ├── MATCHING.cc ├── MDOLLS.cc ├── ORDERSET.cc ├── PHONELST.cc ├── RMQSQ.cc └── YODANESS.cc ├── TODO ├── TheJobOverflow ├── 00265-Dice Palindrome.py └── 00285-K Closest.cc ├── Timus Online Judge ├── 1042.cc ├── 1397.cc └── 1671.cc ├── TopCoder ├── CombinationLockDiv1.cc ├── CombinationLockDiv2.cc ├── PeriodicJumping.cc ├── PowerOfThree.py └── TheNicePair.cc ├── UESTC OJ └── 181.cc ├── UOJ └── 80.cc ├── URIOJ ├── 1001.py └── 1382.cc ├── UVA OJ ├── 100.cc ├── 10010.cc ├── 10035.cc ├── 10055.java ├── 10071.cc ├── 101.cc ├── 10110.cc ├── 10115.cc ├── 10132.cc ├── 10300.cc ├── 10341.cc ├── 10361.cc ├── 10635.cc ├── 10763.cc ├── 10815.cc ├── 10878.cc ├── 10881.py ├── 10891.cc ├── 10905.cc ├── 11022.py ├── 11078.cc ├── 1121.cc ├── 11292.py ├── 113.cc ├── 11300.py ├── 11384.py ├── 11462.py ├── 11464.cc ├── 11475.py ├── 11549.cc ├── 1160.py ├── 11972.cc ├── 11995.cc ├── 120.cc ├── 127.cc ├── 133.cc ├── 1388.py ├── 1394.py ├── 248.cc ├── 270.cc ├── 327.cc ├── 340.cc ├── 401.cc ├── 409.cc ├── 414.cc ├── 424.cc ├── 437.cc ├── 445.cc ├── 455.py ├── 457.cc ├── 458.cc ├── 465.cc ├── 488.cc ├── 489.cc ├── 490.cc ├── 494.cc ├── 501.cc ├── 514.cc ├── 515.cc ├── 537.cc ├── 575.cc ├── 644.cc ├── 667.cc ├── 673.cc ├── 694.cc ├── 705.cc ├── 827.cc └── 920.cc ├── UVALive ├── 11729.cc ├── 3939.cc ├── 3942.cc ├── 4638.cc ├── 4766.cc ├── 4772.cc ├── 4773.cc ├── 4856.cc ├── 5034.cc ├── 5068.cc ├── 5255.cc ├── 5815.cc ├── 5983.cc ├── 5984.cc ├── 5985.cc ├── 5989.cc └── 5990.cc ├── Ural ├── 1015.cc ├── 1091.py └── 1677.py ├── XDU OJ └── 1007.cc ├── XTUOJ └── 1238.cc ├── ZJUT └── 1381.cc ├── ZOJ ├── 1001.py ├── 1013.cc ├── 1037.py ├── 1048.py ├── 1049.py ├── 1067.py ├── 1099.py ├── 1115.py ├── 1151.py ├── 1201.py ├── 1217.cc ├── 1240.py ├── 1251.py ├── 1350.py ├── 1405.py ├── 1492.cc ├── 1610.cc ├── 1796.py ├── 1798.cc ├── 1874.cc ├── 2001.py ├── 2334.cc ├── 2416.cc ├── 2836.py ├── 3160.cc ├── 3190.cc ├── 3228.cc ├── 3233.cc ├── 3271.cc ├── 3469.cc ├── 3494.cc ├── 3531.cc ├── 3537.cc ├── 3603.py ├── 3609.py ├── 3610.py ├── 3611.cc ├── 3621.cc ├── 3622.cc ├── 3623.cc ├── 3626.cc ├── 3629.py ├── 3630.cc ├── 3631.cc ├── 3632.cc ├── 3656.cc ├── 3659.cc └── 3665.cc ├── codingame ├── Onboarding.py └── The Resistance.cc ├── hihoCoder ├── 1015.cc ├── 1032.cc ├── 1100.py ├── 1102.py ├── 1103.cc ├── 1106.cc ├── 1138.cc ├── 1153.cc ├── 1197.py ├── 1199.cc ├── 1223.py ├── 1224.cc ├── 1237.py ├── 1239.cc ├── 1269.cc ├── 1270.cc ├── 1272.cc ├── 1273.cc ├── 1283.py ├── 1305.cc ├── 1309.cc ├── 1327.cc ├── 1330.cc ├── 1338.cc ├── 1362.py ├── 1409.py ├── 1410.py ├── 1458.cc ├── 1486.cc ├── 1696.py ├── 1697.py ├── 1744.py ├── 1745.py ├── 1746.cc ├── 1747.cc ├── 1748.py ├── 1749.cc ├── 1750.cc └── 1769.py ├── itint5 ├── cpp │ ├── Excel数转换.cc │ ├── 两有序数组的交和并.cc │ ├── 判断数独状态.cc │ ├── 支持删除的后继查询.cc │ └── 统计完全二叉树结点数.cc └── python │ ├── 统计完全二叉树结点数.cc │ └── 表达式求值.py ├── map_4358.cc └── vijos ├── 1000.py └── 1053.cc /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | *.swp 4 | *.swo 5 | 6 | *.pyc 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "foam.files.ignore": [ 3 | "README", 4 | "README.md", 5 | "*/README", 6 | "*/README.md", 7 | "**/README.md", 8 | "**/README" 9 | ], 10 | } -------------------------------------------------------------------------------- /51nod/1000.scl: -------------------------------------------------------------------------------- 1 | object Solution { 2 | def main(args: Array[String]) { 3 | System.out.println( 4 | readLine split(" ") map(_.toInt) sum 5 | ); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /51nod/1001.cc: -------------------------------------------------------------------------------- 1 | (k, n) = map(int, raw_input().split()) 2 | ns = sorted([int(raw_input()) for i in xrange(n)]) 3 | s = set(ns) 4 | 5 | cnt = 0 6 | for p in ns: 7 | q = k - p 8 | if q > p and q in s: 9 | print p, q 10 | cnt += 1 11 | 12 | if not cnt: 13 | print 'No Solution' 14 | -------------------------------------------------------------------------------- /51nod/1002.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | tree = [ 3 | map(int, raw_input().split()) 4 | for i in xrange(n) 5 | ] 6 | 7 | for i in xrange(n - 1, -1, -1): 8 | for j in xrange(i): 9 | a = tree[i][j] 10 | b = tree[i][j + 1] 11 | tree[i - 1][j] += max(a, b) 12 | 13 | print tree[0][0] 14 | -------------------------------------------------------------------------------- /51nod/1003.py: -------------------------------------------------------------------------------- 1 | def factors(n, x): 2 | res = 0 3 | i = x 4 | while i <= n: 5 | res += n / i 6 | i *= x 7 | return res 8 | 9 | n = int(raw_input()) 10 | 11 | n2 = factors(n, 2) 12 | n5 = factors(n, 5) 13 | 14 | print min(n2, n5) 15 | -------------------------------------------------------------------------------- /51nod/1004.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | m = n 4 | res = 1 5 | 6 | while n: 7 | if n & 1: 8 | res *= m 9 | m *= m 10 | 11 | res %= 10 12 | m %= 10 13 | n /= 2 14 | print res 15 | -------------------------------------------------------------------------------- /51nod/1005.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var a, b big.Int 10 | fmt.Scanf("%d %d", &a, &b) 11 | fmt.Println(a.Add(&a, &b)) 12 | } 13 | -------------------------------------------------------------------------------- /51nod/1008.py: -------------------------------------------------------------------------------- 1 | (n, p) = map(int, raw_input().split()) 2 | 3 | res = 1 4 | for i in xrange(1, n + 1): 5 | res = (res * i) % p 6 | print res 7 | -------------------------------------------------------------------------------- /51nod/1011.py: -------------------------------------------------------------------------------- 1 | def gcd(a, b): 2 | if a % b == 0: 3 | return b 4 | return gcd(b, a % b) 5 | 6 | (a, b) = map(int, raw_input().split()) 7 | print gcd(a, b) 8 | -------------------------------------------------------------------------------- /51nod/1012.py: -------------------------------------------------------------------------------- 1 | def gcd(a, b): 2 | if a % b == 0: 3 | return b 4 | return gcd(b, a % b) 5 | 6 | (a, b) = map(int, raw_input().split()) 7 | 8 | print a * b / gcd(a, b) 9 | -------------------------------------------------------------------------------- /51nod/1013.py: -------------------------------------------------------------------------------- 1 | MOD = (10 ** 9) + 7 2 | n = int(raw_input()) + 1 3 | 4 | a = (pow(3, n, MOD) - 1 + MOD) % MOD 5 | b = pow(2, MOD - 2, MOD) 6 | print a * b % MOD 7 | -------------------------------------------------------------------------------- /51nod/1014.py: -------------------------------------------------------------------------------- 1 | (p, a) = map(int, raw_input().split()) 2 | ns = [] 3 | 4 | for i in xrange(0, p + 1): 5 | if (i * i) % p == a: 6 | ns.append(i) 7 | 8 | if ns: 9 | print ' '.join(map(str, ns)) 10 | else: 11 | print 'No Solution' 12 | -------------------------------------------------------------------------------- /51nod/1015.py: -------------------------------------------------------------------------------- 1 | def do_detect(n): 2 | l = len(str(n)) 3 | m = sum(map(lambda x: x ** l, map(int, str(n)))) 4 | #print n, m 5 | return n == m 6 | 7 | n = int(raw_input()) 8 | 9 | while True: 10 | if do_detect(n): 11 | print n 12 | break 13 | n += 1 14 | -------------------------------------------------------------------------------- /51nod/1024.py: -------------------------------------------------------------------------------- 1 | (m, n, a, b) = map(int, raw_input().split()) 2 | 3 | print \ 4 | len( 5 | set( 6 | [i ** j for i in xrange(a, a + n) for j in xrange(b, b + m)] 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /51nod/1027.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var a, b big.Int 10 | fmt.Scanf("%d %d", &a, &b) 11 | fmt.Println(a.Mul(&a, &b)) 12 | } 13 | -------------------------------------------------------------------------------- /51nod/1028.py: -------------------------------------------------------------------------------- 1 | a = int(raw_input()) 2 | b = int(raw_input()) 3 | 4 | print a * b 5 | -------------------------------------------------------------------------------- /51nod/1029.py: -------------------------------------------------------------------------------- 1 | a = int(raw_input()) 2 | b = int(raw_input()) 3 | 4 | print a / b 5 | print a % b 6 | -------------------------------------------------------------------------------- /51nod/1030.py: -------------------------------------------------------------------------------- 1 | print(int(raw_input(), 36)) 2 | -------------------------------------------------------------------------------- /51nod/1031.py: -------------------------------------------------------------------------------- 1 | MOD = (10 ** 9) + 7 2 | 3 | n = int(raw_input()) 4 | 5 | a, b = 1, 1 6 | 7 | for i in xrange(2, n + 1): 8 | c = a + b 9 | a, b = b % MOD, c % MOD 10 | 11 | print b 12 | -------------------------------------------------------------------------------- /51nod/1046.py: -------------------------------------------------------------------------------- 1 | (a, b, c) = map(int, raw_input().split()) 2 | 3 | aa = a 4 | res = 1 5 | while b: 6 | if b & 1: 7 | res = (res * aa) % c 8 | aa = (aa * aa) % c 9 | b >>= 1 10 | print res % c 11 | -------------------------------------------------------------------------------- /51nod/1057.py: -------------------------------------------------------------------------------- 1 | print reduce(lambda x, y: x * y, range(1, int(raw_input()) + 1), 1) 2 | -------------------------------------------------------------------------------- /51nod/1058.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | x = int(raw_input()) 4 | 5 | a = math.log10(math.sqrt(2 * math.pi * x)) 6 | b = math.log10(x / math.e) * x 7 | 8 | print int(a + b + 1) 9 | -------------------------------------------------------------------------------- /51nod/1066.py: -------------------------------------------------------------------------------- 1 | def solve(n, k): 2 | if n % (k + 1) == 0: 3 | return 'B' 4 | else: 5 | return 'A' 6 | 7 | T = int(raw_input()) 8 | 9 | for i in xrange(T): 10 | (n, k) = map(int, raw_input().split()) 11 | print solve(n, k) 12 | -------------------------------------------------------------------------------- /51nod/1067.py: -------------------------------------------------------------------------------- 1 | wl = [0, 1, 0, 1] 2 | for i in xrange(10): 3 | ptr = 4 + i 4 | u = (wl[ptr - 1] ^ 1)| (wl[ptr - 3] ^ 1) | (wl[ptr - 4] ^ 1) 5 | wl.append(u) 6 | 7 | n = int(raw_input()) 8 | for i in xrange(n): 9 | x = int(raw_input()) % 7 10 | print 'A' if wl[x] else 'B' 11 | -------------------------------------------------------------------------------- /51nod/1068.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for i in xrange(T): 4 | n = int(raw_input()) 5 | print 'A' if n % 3 != 0 else 'B' 6 | -------------------------------------------------------------------------------- /51nod/1069.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, [raw_input() for i in xrange(n)]) 3 | print 'B' if reduce(lambda x, y: x ^ y, ns) == 0 else 'A' 4 | -------------------------------------------------------------------------------- /51nod/1070.py: -------------------------------------------------------------------------------- 1 | s = set([]) 2 | 3 | a, b = 1, 1 4 | while a < 10 ** 10: 5 | a, b = b, a + b 6 | s.add(a) 7 | 8 | n = int(raw_input()) 9 | for i in xrange(n): 10 | x = int(raw_input()) 11 | if x in s: 12 | print 'B' 13 | else: 14 | print 'A' 15 | -------------------------------------------------------------------------------- /51nod/1072.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | m = (math.sqrt(5) + 1) / 2 4 | 5 | n = int(raw_input()) 6 | 7 | for i in xrange(n): 8 | (a, b) = map(int, raw_input().split()) 9 | (a, b) = min(a, b), max(a, b) 10 | delta = b - a 11 | if a == int(m * delta): 12 | print 'B' 13 | else: 14 | print 'A' 15 | -------------------------------------------------------------------------------- /51nod/1073.py: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | s = 0 3 | for i in xrange(2, n + 1): 4 | s = (s + m) % i 5 | print s + 1 6 | 7 | -------------------------------------------------------------------------------- /51nod/1081.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [0] + [int(raw_input()) for i in xrange(n)] 3 | 4 | for i in xrange(1, n + 1): 5 | ns[i] += ns[i - 1] 6 | 7 | q = int(raw_input()) 8 | for i in xrange(q): 9 | (a, b) = map(int, raw_input().split()) 10 | print ns[a + b - 1] - ns[a - 1] 11 | -------------------------------------------------------------------------------- /51nod/1082.py: -------------------------------------------------------------------------------- 1 | res = 0 2 | l = [] 3 | for i in xrange(1000001): 4 | if '7' in str(i) or i % 7 == 0: 5 | pass 6 | else: 7 | res += i ** 2 8 | l.append(res) 9 | 10 | T = int(raw_input()) 11 | 12 | for i in xrange(T): 13 | n = int(raw_input()) 14 | print l[n] 15 | -------------------------------------------------------------------------------- /51nod/1091.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [map(int, raw_input().split()) for i in xrange(n)] 3 | 4 | ns.sort() 5 | 6 | maxi = 0 7 | ans = 0 8 | 9 | for i in xrange(n): 10 | st = ns[i][0] 11 | end = ns[i][1] 12 | 13 | ans = max(ans, min(end, maxi) - st) 14 | maxi = max(maxi, end) 15 | 16 | print ans 17 | -------------------------------------------------------------------------------- /51nod/1096.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = sorted([int(raw_input()) for i in xrange(n)]) 3 | 4 | pivot = ns[n / 2] 5 | print sum(map(lambda x: abs(pivot - x), ns)) 6 | -------------------------------------------------------------------------------- /51nod/1097.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [raw_input() for i in xrange(n)] 3 | 4 | ans = ''.join(sorted(ns, cmp=lambda x, y: cmp(int(x + y), int(y + x)))) 5 | l = len(ans) 6 | 7 | for i in xrange(0, l, 1000): 8 | print ''.join(ans[i: i + 1000]) 9 | -------------------------------------------------------------------------------- /51nod/1099.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [tuple(map(int, raw_input().split())) for i in xrange(n)] 3 | 4 | ns.sort(cmp=lambda x, y: cmp(x[1] + y[0], y[1] + x[0])) 5 | 6 | a, b = 0, 0 7 | 8 | for item in ns: 9 | if a - b < item[0]: 10 | a = b + item[0] 11 | b += item[1] 12 | 13 | print a 14 | -------------------------------------------------------------------------------- /51nod/1116.py: -------------------------------------------------------------------------------- 1 | n = raw_input() 2 | 3 | for i in xrange(36, 1, -1): 4 | u = int(n, i) 5 | if u % (i - 1) == 0: 6 | print i 7 | break 8 | else: 9 | print 'No Solution' 10 | -------------------------------------------------------------------------------- /51nod/1117.py: -------------------------------------------------------------------------------- 1 | import heapq 2 | 3 | n = int(raw_input()) 4 | ns = [int(raw_input()) for i in xrange(n)] 5 | 6 | heapq.heapify(ns) 7 | 8 | ans = 0 9 | while len(ns) > 1: 10 | a = heapq.heappop(ns) 11 | b = heapq.heappop(ns) 12 | ans += a + b 13 | heapq.heappush(ns, a + b) 14 | print ans 15 | -------------------------------------------------------------------------------- /51nod/1118.py: -------------------------------------------------------------------------------- 1 | MOD = (10 ** 9 + 7) 2 | 3 | (n, m) = map(int, raw_input().split()) 4 | 5 | ans = 1 6 | for i in xrange(n - 1): 7 | ans *= (m + n - 2 - i) 8 | ans /= (i + 1) 9 | 10 | print ans % MOD 11 | -------------------------------------------------------------------------------- /51nod/1130.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | T = int(raw_input()) 4 | 5 | for i in xrange(T): 6 | x = int(raw_input()) 7 | 8 | a = math.log10(math.sqrt(2 * math.pi * x)) 9 | b = math.log10(x / math.e) * x 10 | 11 | print int(a + b + 1) 12 | -------------------------------------------------------------------------------- /51nod/1166.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import decimal 3 | 4 | sys.stdin = open('input.txt') 5 | 6 | decimal.getcontext().prec = 100000 7 | a = decimal.Decimal(raw_input()) 8 | print '%d' % a.sqrt().to_integral(rounding=decimal.ROUND_DOWN) 9 | -------------------------------------------------------------------------------- /51nod/1182.py: -------------------------------------------------------------------------------- 1 | d = {} 2 | for item in raw_input().lower(): 3 | d[item] = d.get(item, 0) + 1 4 | 5 | res = 0 6 | l = sorted(d.values(), reverse=True) 7 | for i, num in enumerate(l): 8 | res += (26 - i) * num 9 | print res 10 | -------------------------------------------------------------------------------- /51nod/1262.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | n += 1 4 | 5 | ans = n 6 | cur = 2 7 | while n > 1: 8 | cnt = 0 9 | while n % cur == 0: 10 | n /= cur 11 | cnt += 1 12 | if cnt: 13 | ans = ans / cur * (cur - 1) 14 | cur += 1 15 | print ans 16 | -------------------------------------------------------------------------------- /51nod/1266.py: -------------------------------------------------------------------------------- 1 | (n, l) = map(int, raw_input().split()) 2 | ns = [int(raw_input()) for i in xrange(n)] 3 | 4 | a = max(map(lambda x: min(x, l - x), ns)) 5 | b = max(map(lambda x: max(x, l - x), ns)) 6 | 7 | print a, b 8 | -------------------------------------------------------------------------------- /51nod/1344.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [int(raw_input()) for i in xrange(n)] 3 | 4 | res = 1 5 | for num in ns[::-1]: 6 | if num < 0: 7 | res += abs(num) 8 | else: 9 | res = max(0, res - num) 10 | print res 11 | -------------------------------------------------------------------------------- /51nod/1347.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def solve(line): 4 | n = len(line) 5 | if n % 2: 6 | return False 7 | return line[:n/2] == line[n/2:] 8 | for line in sys.stdin: 9 | if solve(line.strip()): 10 | print 'YES' 11 | else: 12 | print 'NO' 13 | -------------------------------------------------------------------------------- /51nod/1381.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for i in xrange(T): 4 | x = int(raw_input()) 5 | print x * 2 6 | -------------------------------------------------------------------------------- /51nod/1413.py: -------------------------------------------------------------------------------- 1 | print max(map(int, list(raw_input()))) 2 | -------------------------------------------------------------------------------- /51nod/1414.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input().split()) 3 | 4 | ans = sum(ns) 5 | 6 | i = 2 7 | while i <= n: 8 | if n % i or n / i < 3: 9 | i += 1 10 | continue 11 | for j in xrange(i): 12 | ans = max(ans, sum(ns[j::i])) 13 | i += 1 14 | print ans 15 | -------------------------------------------------------------------------------- /51nod/1417.py: -------------------------------------------------------------------------------- 1 | def gcd(a, b): 2 | if a % b == 0: 3 | return b 4 | return gcd(b, a % b) 5 | 6 | n = int(raw_input()) 7 | for i in xrange(n): 8 | (a, b) = map(int, raw_input().split()) 9 | x = a + 3 * b 10 | y = 4 * (a + b) 11 | z = gcd(x, y) 12 | print '%d/%d' % (x / z, y / z) 13 | -------------------------------------------------------------------------------- /51nod/1420.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = sorted([int(raw_input()) for i in xrange(n)]) 3 | 4 | p = n / 2 - 1 5 | q = n - 1 6 | ans = 0 7 | while p >= 0 and q >= 0: 8 | if ns[p] * 2 <= ns[q]: 9 | ans += 1 10 | p -= 1 11 | q -= 1 12 | else: 13 | p -= 1 14 | print n - ans 15 | -------------------------------------------------------------------------------- /51nod/1431.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input().split()) 3 | 4 | for i in xrange(n): 5 | ns[i] -= n - i 6 | 7 | print 'Happy' if len(set(ns)) == n else 'Sad' 8 | -------------------------------------------------------------------------------- /51nod/1432.py: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | ns = sorted([int(raw_input()) for i in xrange(n)]) 3 | 4 | p, q = 0, n - 1 5 | 6 | ans = 0 7 | 8 | while p < q: 9 | if ns[p] + ns[q] > m: 10 | q -= 1 11 | else: 12 | ans += 1 13 | p += 1 14 | q -= 1 15 | print n - ans 16 | -------------------------------------------------------------------------------- /51nod/1433.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.stdin = open('input.txt') 3 | 4 | n = int(raw_input()) 5 | ns = map(int, raw_input().split()) 6 | 7 | s = sum(ns) / 45 * 9 8 | 9 | if ns.count(0) != 0: 10 | print int('5' * s + '0' * ns.count(0)) 11 | else: 12 | print -1 13 | -------------------------------------------------------------------------------- /51nod/1605.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | (n, m) = map(int, raw_input().split()) 5 | s = 0 6 | for i in xrange(n): 7 | s += sum(map(int, raw_input().split())) 8 | if s & 1: 9 | print 'yadang' 10 | else: 11 | print 'xiawa' 12 | -------------------------------------------------------------------------------- /51nod/1639.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | ans = 1.0 4 | for i in xrange(n, 1, -1): 5 | ans = ans * (i * 2 - 2) / (i * 2 - 1) 6 | print ans 7 | -------------------------------------------------------------------------------- /51nod/1717.py: -------------------------------------------------------------------------------- 1 | import math 2 | n = int(raw_input()) 3 | m = int(math.sqrt(n)) 4 | print n - m 5 | -------------------------------------------------------------------------------- /51nod/1718.py: -------------------------------------------------------------------------------- 1 | import math 2 | n = int(raw_input()) % 6 3 | print str(math.cos(math.pi * n / 3) * 2)[:-2] 4 | -------------------------------------------------------------------------------- /51nod/1873.py: -------------------------------------------------------------------------------- 1 | import decimal 2 | 3 | (a, b) = raw_input().split() 4 | 5 | decimal.getcontext().prec = 4000 6 | while a[-1] == '0': 7 | a = a[:-1] 8 | 9 | c = decimal.Decimal(a) ** decimal.Decimal(b) 10 | print '{0:f}'.format(c).replace('0.', '.') 11 | -------------------------------------------------------------------------------- /51nod/2133.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = sorted(map(int, [raw_input() for i in xrange(n)])) 3 | 4 | res = 0 5 | for i in xrange(n): 6 | res += (n - i) * ns[i] 7 | print res 8 | -------------------------------------------------------------------------------- /51nod/2387.py: -------------------------------------------------------------------------------- 1 | (n, c, d) = map(int, raw_input().split()) 2 | ns = sorted(map(int, raw_input().split()), reverse=True) 3 | 4 | c = (c - d) + 2 * d 5 | 6 | cnt = 0 7 | while c and ns: 8 | if ns[-1] <= c: 9 | c -= ns[-1] 10 | cnt += 1 11 | ns.pop() 12 | else: 13 | break 14 | print cnt 15 | -------------------------------------------------------------------------------- /51nod/2485.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | s = raw_input() 4 | n = len(s) 5 | c = Counter(s) 6 | 7 | maxi = max(c.values()) 8 | if maxi <= (n + 1) / 2: 9 | print 'Possible' 10 | else: 11 | print 'Impossible' 12 | -------------------------------------------------------------------------------- /AcWing/89.py: -------------------------------------------------------------------------------- 1 | a, b, p = map(int, raw_input().split()) 2 | print pow(a, b, p) -------------------------------------------------------------------------------- /AcWing/90.py: -------------------------------------------------------------------------------- 1 | a, b, p = map(int, [raw_input() for i in xrange(3)]) 2 | print a * b % p -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 051/A.py: -------------------------------------------------------------------------------- 1 | print ' '.join(raw_input().split(',')) 2 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 051/B.py: -------------------------------------------------------------------------------- 1 | k, s = map(int, raw_input().split()) 2 | ans = 0 3 | for x in xrange(k + 1): 4 | for y in xrange(k + 1): 5 | z = s - x - y 6 | if z > k or z < 0: 7 | continue 8 | ans += 1 9 | print ans 10 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 151/A.py: -------------------------------------------------------------------------------- 1 | c = raw_input() 2 | c = chr(ord(c) + 1) 3 | print c 4 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 151/B.py: -------------------------------------------------------------------------------- 1 | n, k, m = map(int, raw_input().split()) 2 | ns = map(int, raw_input().split()) 3 | 4 | tot = sum(ns) 5 | exp = m * n 6 | 7 | need = max(0, exp - tot) 8 | 9 | if need > k: 10 | print -1 11 | else: 12 | print need 13 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 151/C.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | n, m = map(int, raw_input().split()) 4 | 5 | aced = set() 6 | d = defaultdict(int) 7 | pen = 0 8 | for i in xrange(m): 9 | p, s = raw_input().split() 10 | p = int(p) 11 | s = s.strip() 12 | 13 | if p in aced: 14 | continue 15 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 153/A.py: -------------------------------------------------------------------------------- 1 | (h, a) = map(int, raw_input().split()) 2 | print (h + a - 1) / a 3 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 153/B.py: -------------------------------------------------------------------------------- 1 | (h, n) = map(int, raw_input().split()) 2 | ns = map(int, raw_input().split()) 3 | 4 | if h > sum(ns): 5 | print 'No' 6 | else: 7 | print 'Yes' 8 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 153/C.py: -------------------------------------------------------------------------------- 1 | (n, k) = map(int, raw_input().split()) 2 | hs = map(int, raw_input().split()) 3 | 4 | hs.sort() 5 | 6 | while hs and k: 7 | hs.pop() 8 | k -= 1 9 | 10 | print sum(hs) 11 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 165/C.py: -------------------------------------------------------------------------------- 1 | def solve(a, b, n): 2 | return a * min(b - 1, n) / b 3 | 4 | assert solve(5, 7, 4) == 2 5 | assert solve(1, 1, 1) == 0 6 | assert solve(11, 10, 9) == 9 7 | 8 | (a, b, n) = map(int, raw_input().split()) 9 | 10 | print solve(a, b, n) 11 | 12 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 185/A.fs: -------------------------------------------------------------------------------- 1 | // Learn more about F# at http://fsharp.org 2 | 3 | open System 4 | 5 | [] 6 | let main argv = 7 | let ns = (Console.ReadLine()).Split(' ') |> Array.map int 8 | printfn "%d\n" (Array.reduce min ns) 9 | 0 // return an integer exit code 10 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 199/A.py: -------------------------------------------------------------------------------- 1 | a, b, c = map(int, raw_input().split()) 2 | print "Yes" if a * a + b * b < c * c else "No" 3 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 199/B.py: -------------------------------------------------------------------------------- 1 | INF = 10 ** 10 2 | 3 | n = int(raw_input()) 4 | A = map(int, raw_input().split()) 5 | B = map(int, raw_input().split()) 6 | 7 | l = -INF 8 | r = INF 9 | 10 | for (a, b) in zip(A, B): 11 | l = max(l, a) 12 | r = min(r, b) 13 | 14 | 15 | print max(0, r - l + 1) 16 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 202/A.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | 3 | a, b, c = map(int, raw_input().split()) 4 | 5 | print sum(map(lambda x: 7 - x, [a, b, c])) 6 | 7 | ''' 8 | ^^^TEST^^^ 9 | 5 6 4 10 | ----- 11 | 6 12 | $$$TEST$$$ 13 | ''' 14 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 202/B.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | 3 | d = { 4 | '0': '0', 5 | '1': '1', 6 | '6': '9', 7 | '8': '8', 8 | '9': '6' 9 | } 10 | 11 | s = raw_input() 12 | print ''.join(map(lambda c: d[c], s))[::-1] 13 | 14 | ''' 15 | ^^^TEST^^^ 16 | 0601889 17 | ----- 18 | 6881090 19 | $$$TEST$$$ 20 | ''' 21 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 218/A.py: -------------------------------------------------------------------------------- 1 | q = int(raw_input()) 2 | days = raw_input() 3 | 4 | print 'Yes' if days[q - 1] == 'o' else 'No' 5 | 6 | ''' 7 | ^^^TEST^^^ 8 | 4 9 | oooxoox 10 | ------- 11 | No 12 | $$$TEST$$$ 13 | 14 | ^^^TEST^^^ 15 | 7 16 | ooooooo 17 | ------- 18 | Yes 19 | $$$TEST$$$ 20 | ''' 21 | 22 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 225/A.py: -------------------------------------------------------------------------------- 1 | from itertools import permutations 2 | s = raw_input() 3 | s = sorted(s) 4 | 5 | print len(set(permutations(s))) 6 | 7 | 8 | 9 | ''' 10 | 11 | ^^^TEST^^^ 12 | aba 13 | ------- 14 | 3 15 | $$$TEST$$$ 16 | 17 | ^^^TEST^^^ 18 | abc 19 | ------- 20 | 6 21 | $$$TEST$$$ 22 | 23 | ''' 24 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 231/A.py: -------------------------------------------------------------------------------- 1 | D = int(raw_input()) 2 | 3 | print '%.10f' % (1.0 * D / 100) 4 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 247/A.py: -------------------------------------------------------------------------------- 1 | ns = raw_input().strip() 2 | u = int(ns, 2) 3 | print '{:04b}'.format(u >> 1) 4 | 5 | ''' 6 | ^^^^TEST^^^ 7 | 1011 8 | ----- 9 | 0101 10 | $$$TEST$$$ 11 | 12 | ^^^TEST^^^ 13 | 1111 14 | ----- 15 | 0111 16 | $$$TEST$$$ 17 | ''' 18 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 248/A.py: -------------------------------------------------------------------------------- 1 | s = raw_input() 2 | 3 | print list(set(s) ^ set('0123456789'))[0] 4 | 5 | ''' 6 | ^^^^TEST^^^ 7 | 459230781 8 | ------ 9 | 6 10 | $$$TEST$$$ 11 | ''' 12 | -------------------------------------------------------------------------------- /AtCoder/AtCoder Beginner Contest 282/A.py: -------------------------------------------------------------------------------- 1 | import string 2 | 3 | n = int(raw_input()) 4 | print string.uppercase[:n] 5 | 6 | ''' 7 | ^^^^TEST^^^^ 8 | 3 9 | --------- 10 | ABC 11 | $$$TEST$$$ 12 | ''' 13 | -------------------------------------------------------------------------------- /AtCoder/Hitachi Programming Contest 2020/A.py: -------------------------------------------------------------------------------- 1 | # https://atcoder.jp/contests/hitachi2020/tasks/hitachi2020_a 2 | 3 | s = raw_input() 4 | n = len(s) 5 | if n % 2 != 0: 6 | print 'No' 7 | else: 8 | m = n / 2 9 | pattern = 'hi' * m 10 | print 'Yes' if pattern == s else 'No' 11 | -------------------------------------------------------------------------------- /AtCoder/M-SOLUTIONS Programming Contest 2020/A.py: -------------------------------------------------------------------------------- 1 | def solve(x): 2 | x -= 400 3 | return 8 - x / 200 4 | 5 | assert solve(400) == 8 6 | assert solve(401) == 8 7 | assert solve(599) == 8 8 | assert solve(1599) == 3 9 | assert solve(1800) == 1 10 | assert solve(1999) == 1 11 | 12 | x = int(raw_input()) 13 | print solve(x) 14 | -------------------------------------------------------------------------------- /AtCoder/Panasonic Programming Contest 2020/A.py: -------------------------------------------------------------------------------- 1 | # https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_a 2 | s = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51' 3 | s = map(int, s.split(',')) 4 | k = int(raw_input()) 5 | print s[k - 1] 6 | -------------------------------------------------------------------------------- /AtCoder/Panasonic Programming Contest 2020/B.py: -------------------------------------------------------------------------------- 1 | # https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_b 2 | 3 | (n, m) = map(int, raw_input().split()) 4 | 5 | res = 0 6 | 7 | if n == 1 or m == 1: 8 | print 1 9 | else: 10 | res += ((n + 1) / 2) * ((m + 1) / 2) 11 | res += (n / 2) * (m / 2) 12 | print res 13 | -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1000.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int a,b; 5 | scanf("%d%d",&a,&b); 6 | printf("%d\n",a+b); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1016.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1016.cc -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1031.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int mul(int i) 5 | { 6 | return i*i; 7 | } 8 | int main() 9 | { 10 | int a; 11 | scanf("%d",&a); 12 | if(mul( (int) sqrt( (double) a) )==a) printf("Yes\n"); 13 | else printf("No\n"); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1043.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1043.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1048.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1048.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1053.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int mean,a; 6 | scanf("%d%d",&a,&mean); 7 | printf("%d\n",mean*2-a); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1073.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int black=0,white=0,temp; 6 | int n,i; 7 | scanf("%d",&n); 8 | for(i=0;i 2 | #include 3 | 4 | int main() 5 | { 6 | int n; 7 | scanf("%d",&n); 8 | long long sum=( (long long)(1+n)*n )/2; 9 | for(int i=0;i 2 | #include 3 | 4 | int main() 5 | { 6 | int n; 7 | scanf("%d",&n); 8 | if(n>0) printf("%d\n",( (1+n)*n )/2); 9 | else printf("%d\n",( (-1+n)*(-n) )/2+1); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1234.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1234.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1256.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1256.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1265.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1265.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1286.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1286.cc -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1328.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | long long n; 6 | scanf("%lld",&n); 7 | while(n!=0) 8 | { 9 | printf("%lld\n",n-n/2); 10 | scanf("%lld",&n); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1415.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int n,c; 6 | while(scanf("%d%d",&n,&c)!=EOF) 7 | { 8 | if(!n||!c) printf("0\n"); 9 | else 10 | { 11 | int t=c/n/2; 12 | int sign=0; 13 | if(c>n+2*n*t) sign=1; 14 | printf("%d\n",t+sign); 15 | } 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1416.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int mul(int n) 5 | { 6 | return n*n; 7 | } 8 | 9 | int main() 10 | { 11 | int x1,y1; 12 | int x2,y2; 13 | scanf("%d%d%d%d",&x1,&y1,&x2,&y2); 14 | printf("%d\n",(mul(x2-x1)+mul(y1+y2))); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1417.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long fab(int n) 4 | { 5 | if(n==1||n==2) return 1; 6 | else return fab(n-1)+fab(n-2); 7 | } 8 | 9 | int main() 10 | { 11 | int n; 12 | scanf("%d",&n); 13 | printf("%lld\n",fab(n)); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1418.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int n,k; 8 | cin>>n>>k; 9 | int array[900]; 10 | for(int i=0;i 2 | 3 | int main() 4 | { 5 | double year; 6 | scanf("%lf",&year); 7 | printf("%.3lf\n",year*150); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1561.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | double a,b,h; 6 | scanf("%lf%lf%lf",&a,&b,&h); 7 | printf("%.3lf\n",(a+b)*h/2); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1747.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1747.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1826.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | 7 | int alpha[26]={52,6,18,21,71,13,26,35,46,1,6,26,17,44,61,19,1,33,32,72,26,5,13,0,15,0}; 8 | 9 | for(int i=0;i<26;i++) 10 | { 11 | printf("%c,%d\n",'A'+i,alpha[i]); 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1827.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | double input; 8 | scanf("%lf",&input); 9 | printf("%.3lf\n",-5730*log2(input)); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1829.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | char temp[30]; 7 | scanf("%s",temp); 8 | int len=strlen(temp); 9 | for(int i=0;i 2 | #include 3 | 4 | int main() 5 | { 6 | float Vs,Vi,f; 7 | scanf("%f,%f,%f",&Vs,&Vi,&f); 8 | f=(340-Vi)*f/(340-Vs); 9 | printf("%.2f\n",f); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1833.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int n; 8 | scanf("%d",&n); 9 | if(n>60) printf("0.800\n"); 10 | else 11 | { 12 | float cut=0.6; 13 | cut=pow(cut,4-n/15); 14 | printf("%.3f\n",cut); 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1838.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | int n; 7 | scanf("%d",&n); 8 | 9 | for(int i=0;i 2 | main(){int a,b;while(scanf("%d,%d",&a,&b)==2)printf("%d\n",a-b>0?a-b:b-a);} -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1879.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int J[14]={2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881,13482720}; 4 | 5 | 6 | int main() 7 | { 8 | int n; 9 | scanf("%d",&n); 10 | while(n!=0) 11 | { 12 | printf("%d\n",J[n-1]); 13 | scanf("%d",&n); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1880.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/BUPT OJ/o.boj/1880.cpp -------------------------------------------------------------------------------- /BUPT OJ/o.boj/1900.cc: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int n,m,s,i; 5 | while(scanf("%d%d",&n,&m)!=EOF) 6 | { 7 | s=0; 8 | for(i=2;i<=n;i++) s=(s+m)%i; 9 | printf("%d\n",s+1); 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /Codechef/MINMAX3.py: -------------------------------------------------------------------------------- 1 | (n, k) = map(int, raw_input().split()) 2 | ns = map(int, raw_input().split()) 3 | ms = [] 4 | 5 | for i in xrange(1, n): 6 | a, b = ns[i - 1], ns[i] 7 | ms.append(a + b) 8 | 9 | ms.sort() 10 | #print ms 11 | 12 | print sum(ms[:k - 1]) + ns[0] + ns[-1], sum(ms[-k + 1:]) + ns[0] + ns[-1] 13 | -------------------------------------------------------------------------------- /Codeeval/Moderate/Longest Lines.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.stdin = open(sys.argv[1], 'r') 3 | 4 | n = int(raw_input()) 5 | strs = [line.strip() for line in sys.stdin] 6 | 7 | print '\n'.join( 8 | sorted(strs, cmp=lambda x, y: cmp(len(x), len(y)), reverse=True)[:n]) 9 | -------------------------------------------------------------------------------- /Codeforces/208A.py: -------------------------------------------------------------------------------- 1 | #Result:Sep 19, 2012 5:51:33 PM Wizmann 208A - Dubstep Python Accepted 62 ms 2800 KB 2 | import re 3 | for item in re.split("WUB",raw_input()): 4 | if(item): print item, 5 | -------------------------------------------------------------------------------- /Codeforces/CodeForces - 23B/B.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | for case_ in xrange(T): 3 | n = int(raw_input()) 4 | print 0 if n == 1 else n - 2 5 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Beta Round #65 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | for i in xrange(n): 3 | word = raw_input().strip() 4 | if len(word) > 10: 5 | word = ''.join([word[0], str(len(word) - 2), word[-1]]) 6 | print word 7 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #148 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | #Nov 6, 2012 4:44:07 AM Wizmann A - Two Bags of Potatoes Python Accepted 125 ms 6376 KB 2 | import sys,re,os 3 | for lines in sys.stdin: 4 | y,k,n=[int(x) for x in lines.split()] 5 | ans=[x_y-y for x_y in xrange(0,n+1,k) if x_y>y] 6 | print ' '.join(map(str,ans)) if len(ans)>0 else -1 7 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #164 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | #3084200 Feb 8, 2013 7:49:58 PM Wizmann A - Games Python Accepted 46 ms 4 KB 2 | a = [ raw_input().split() for i in xrange(int(raw_input())) ] 3 | print sum( i[0]==j[1] for i in a \ 4 | for j in a ) 5 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #164 (Div. 2)/B.hs: -------------------------------------------------------------------------------- 1 | main = do 2 | n <- fmap read getLine 3 | print $ sum [ (i - 1) * (n - i) + i | i <- [1..n] ] 4 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #164 (Div. 2)/B.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | print sum([(i+1)*(n-i)-i for i in xrange(n)]) 3 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #164 (Div. 2)/B.scl: -------------------------------------------------------------------------------- 1 | object B 2 | { 3 | def main(args: Array[String]) 4 | { 5 | val n = readLine.toInt 6 | println( (for(i<-0 until n) yield (i+1)*(n-i)-i) sum) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #164 (Div. 2)/C.py: -------------------------------------------------------------------------------- 1 | n, m = map(int, raw_input().split()) 2 | k = min(n, m) + 1 3 | print k 4 | for i in xrange(k): 5 | print n-i,i 6 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #165 (Div. 2)/a.py: -------------------------------------------------------------------------------- 1 | #3045721 Feb 1, 2013 7:35:51 PM Wizmann A - Fancy Fence Python Accepted 46 ms 0 KB 2 | n = int(raw_input()) 3 | for i in xrange(n): 4 | x = int(raw_input()) 5 | print 'YES' if 360 % (180-x) == 0 else 'NO' 6 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #166 (Div. 2)/A.scl: -------------------------------------------------------------------------------- 1 | //3129213 Feb 14, 2013 7:04:59 PM Wizmann A - Beautiful Year Scala Accepted 421 ms 300 KB 2 | object A 3 | { 4 | def main(args: Array[String]) 5 | { 6 | val n = readInt 7 | println((n+1 to 9999) filter(_.toString.distinct.size >= 4) head) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #169 (Div. 2)/D.py: -------------------------------------------------------------------------------- 1 | # https://codeforces.com/problemset/problem/276/D 2 | a, b = map(int, input().split()) 3 | 4 | c = a ^ b 5 | if c == 0: 6 | print(0) 7 | else: 8 | l = len('{:b}'.format(c)) 9 | print((1 << l) - 1) 10 | 11 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #184 (Div. 2)/input.txt~: -------------------------------------------------------------------------------- 1 | 2 1 2 | 10 3 | 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 99999999999999999 4 | 5 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #185 (Div. 2)/B.py: -------------------------------------------------------------------------------- 1 | a, b, c, d = map(int, input().split()) 2 | 3 | eps = 1e-12 4 | 5 | p = 0 6 | pre = 1. 7 | while True: 8 | delta = 1.0 * pre * a / b 9 | if delta < eps: 10 | break 11 | pre = pre * (b - a) / b * (d - c) / d 12 | p += delta 13 | print(p) 14 | 15 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #188 (Div. 2)/libpeerconnection.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/Codeforces/Codeforces Round #188 (Div. 2)/libpeerconnection.log -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #197 (Div. 2)/339A.py: -------------------------------------------------------------------------------- 1 | # 4366954 Aug 29, 2013 8:37:29 PM Wizmann A - Helpful Maths Python 2 Accepted 92 ms 8 KB 2 | print '+'.join(map(str, sorted(map(int, raw_input().split('+'))))) 3 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #200 (Div. 2)/b.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | 3 | (a, b, c) = map(int, raw_input().split()) 4 | 5 | x = a + b - c 6 | y = b - a + c 7 | z = a - b + c 8 | 9 | 10 | if x < 0 or y < 0 or z < 0 or x % 2 or y % 2 or z % 2: 11 | print "Impossible" 12 | else: 13 | print x/2, y/2, z/2 14 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #200 (Div. 2)/c.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | ans = 0 3 | 4 | def process(a, b): 5 | global ans 6 | ans += a / b 7 | a = a % b 8 | if a: 9 | process(b, a) 10 | 11 | (a, b) = map(int, raw_input().split()) 12 | process(a, b) 13 | print ans 14 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #225 (Div. 2)/C.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | cows = map(int, raw_input().split()) 3 | cnt = 0 4 | res = 0 5 | for cow in cows: 6 | cnt += cow 7 | if not cow: 8 | res += cnt 9 | print res 10 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #240 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | bs = map(int, raw_input().split()) 3 | 4 | ts = [0 for i in xrange(n + 1)] 5 | 6 | for b in bs: 7 | for i in xrange(b, n + 1): 8 | if not ts[i]: 9 | ts[i] = b 10 | 11 | print ' '.join(map(str, ts[1:])) 12 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #240 (Div. 2)/B.py: -------------------------------------------------------------------------------- 1 | n, a, b = map(int, raw_input().split()) 2 | ts = map(int, raw_input().split()) 3 | 4 | for t in ts: 5 | c = (t * a) % b 6 | print c / a, 7 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #244 (Div. 2)/427A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | police = 0 3 | ans = 0 4 | for event in map(int, raw_input().split()): 5 | if event >= 0: 6 | police += event 7 | else: 8 | if police == 0: 9 | ans += 1 10 | else: 11 | police -= 1 12 | print ans 13 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #244 (Div. 2)/427E.py: -------------------------------------------------------------------------------- 1 | n, m = map(int, raw_input().split()) 2 | ps = map(int, raw_input().split()) 3 | 4 | l, r = 0, n - 1 5 | 6 | ans = 0 7 | while l < r: 8 | dis = ps[r] - ps[l] 9 | l += m 10 | r -= m 11 | ans += dis * 2 12 | 13 | print ans 14 | 15 | 16 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #251/439A.py: -------------------------------------------------------------------------------- 1 | (n, d) = map(int, raw_input().split()) 2 | ts = map(int, raw_input().split()) 3 | 4 | min_time = sum(ts) + 10 * (len(ts) - 1) 5 | 6 | if min_time > d: 7 | print -1 8 | else: 9 | print (len(ts) - 1) * 2 + (d - min_time) / 5 10 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #251/439B.py: -------------------------------------------------------------------------------- 1 | (n, x) = map(int, raw_input().split()) 2 | ts = map(int, raw_input().split()) 3 | 4 | ans = 0 5 | ts.sort() 6 | for item in ts: 7 | ans += x * item 8 | x = max(1, x - 1) 9 | 10 | print ans 11 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #253/442B.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ps = map(float, raw_input().split()) 3 | 4 | ps.sort(reverse=True) 5 | 6 | good = ps[0] 7 | bad = 1 - good 8 | 9 | ans = good 10 | 11 | for p in ps[1:]: 12 | good, bad = good * (1 - p) + p * bad, bad * (1 - p) 13 | ans = max(ans, good) 14 | 15 | print ans 16 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #253/443A.py: -------------------------------------------------------------------------------- 1 | ls = filter(lambda y: y, map(lambda x: x.strip(), raw_input()[1:-1].split(","))) 2 | print len(set(ls)) 3 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #256 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | a = sum(map(int, raw_input().split())) 2 | b = sum(map(int, raw_input().split())) 3 | n = int(raw_input()) 4 | 5 | na = (a + 4) / 5 6 | nb = (b + 9) / 10 7 | 8 | if na + nb <= n: 9 | print "YES" 10 | else: 11 | print "NO" 12 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #258 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | 3 | step = 0 4 | inc = n * m 5 | 6 | while inc: 7 | inc -= (n + m) - 1 8 | step += 1 9 | n -= 1 10 | m -= 1 11 | 12 | if step % 2: 13 | print 'Akshat' 14 | else: 15 | print 'Malvika' 16 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #264 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | (n, s) = map(int, raw_input().split()) 2 | 3 | ans = -1 4 | for (x, y) in [map(int, raw_input().split()) for i in xrange(n)]: 5 | if x + y / 100. <= s: 6 | ans = max(ans, (100 - y) % 100) 7 | 8 | print ans -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #271 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | keys = list('qwertyuiop asdfghjkl; zxcvbnm,./') 2 | 3 | dd = -1 if raw_input() == 'R' else +1 4 | d = {} 5 | 6 | for i, key in enumerate(keys): 7 | if i + dd >= 0 and i + dd < len(keys): 8 | d[key] = keys[i + dd] 9 | 10 | print ''.join(map(lambda x: d[x], raw_input())) 11 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #272 (Div. 2)/D.py: -------------------------------------------------------------------------------- 1 | (n, k) = map(int, raw_input().split()) 2 | 3 | print (6 * (n - 1) + 5) * k 4 | 5 | for i in xrange(n): 6 | ns = map(lambda x: k * (6 * i + x), [1, 2, 3, 5]) 7 | print ' '.join(map(str, ns)) 8 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #274 (Div. 1)/A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [] 3 | for i in xrange(n): 4 | (a, b) = map(int, raw_input().split()) 5 | ns.append((a, b)) 6 | ns.sort() 7 | 8 | day = 0 9 | for (a, b) in ns: 10 | if day <= b: 11 | day = b 12 | else: 13 | day = a 14 | 15 | print day 16 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #289 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | g = [[1 for i in xrange(n)] for j in xrange(n)] 3 | 4 | for i in xrange(1, n): 5 | for j in xrange(1, n): 6 | g[i][j] = g[i - 1][j] + g[i][j - 1] 7 | 8 | print g[n - 1][n - 1] 9 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #291 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | ns = map(int, list(raw_input())) 2 | 3 | for i, n in enumerate(ns): 4 | if 5 <= n <= 8 or (i != 0 and n == 9): 5 | ns[i] = 9 - n 6 | 7 | print ''.join(map(str, ns)) 8 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #308 (Div. 2)/B.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | ans = 0 4 | 5 | for i in xrange(1, 12): 6 | u = (10 ** i) - (10 ** (i - 1)) 7 | if n >= u: 8 | ans += i * u 9 | n -= u 10 | else: 11 | ans += i * n 12 | n -= n 13 | 14 | print ans 15 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #328 (Div. 2)/b.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | print (n - 2) ** 2 3 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #337 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | if n <= 3 or n % 2 != 0: 4 | print 0 5 | else: 6 | a = n / 2 7 | print (a - 1) / 2 8 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #340 (Div. 2)/A.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CodeRunner 4 | { 5 | class MainClass 6 | { 7 | public static void Main (string[] args) 8 | { 9 | int n = int.Parse(Console.ReadLine()); 10 | Console.Write((int)(n + 4) / 5); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #349 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import math 4 | (d, h, v, e) = map(float, raw_input().split()) 5 | 6 | ee = e * (d / 2) * (d / 2) * math.pi 7 | 8 | if ee >= v: 9 | print 'NO' 10 | else: 11 | print 'YES' 12 | print h * (d / 2) * (d / 2) * math.pi / (v - ee) -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #349 (Div. 2)/B.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input().split()) 3 | 4 | mm = max(ns) 5 | s = sum(ns) 6 | 7 | print mm - (s - mm) + 1 -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #364 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | ns = sorted(enumerate(map(int, input().split())), key=lambda x: x[1]) 3 | 4 | for i in range(n // 2): 5 | print(ns[i][0] + 1, ns[n - i - 1][0] + 1) 6 | 7 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #377 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | a, b = map(int, raw_input().split()) 2 | for i in xrange(1, 11): 3 | x1 = a * i - b 4 | x2 = a * i 5 | 6 | if (x1 >= 0 and x1 % 10 == 0) or (x2 >= 0 and x2 % 10 == 0): 7 | print i 8 | break 9 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #378 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | vowels = 'AEIOUY' 2 | 3 | s = raw_input() 4 | s = [0] + [i + 1 for i, c in enumerate(s) if c in vowels] + [len(s) + 1] 5 | 6 | ans = 0 7 | for i in xrange(1, len(s)): 8 | ans = max(ans, s[i] - s[i - 1]) 9 | 10 | print ans 11 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #554 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | ns = map(lambda x: x % 2, map(int, raw_input().split())) 3 | ms = map(lambda x: x % 2, map(int, raw_input().split())) 4 | 5 | nodd, neven = sum(ns), n - sum(ns) 6 | modd, meven = sum(ms), m - sum(ms) 7 | 8 | print min(nodd, meven) + min(neven, modd) 9 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #613 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | def solve(commands): 4 | c = Counter(commands) 5 | l, r = c.get('L', 0), c.get('R', 0) 6 | return l + r + 1 7 | 8 | assert solve("LRLR") == 5 9 | assert solve("LR") == 3 10 | 11 | n = int(raw_input()) 12 | print solve(raw_input()) 13 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #633 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | def solve(n): 2 | return n 3 | 4 | T = int(raw_input()) 5 | 6 | for case_ in xrange(T): 7 | n = int(raw_input()) 8 | print solve(n) 9 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #633 (Div. 2)/README: -------------------------------------------------------------------------------- 1 | Solutions: https://github.com/Wizmann/ACM-ICPC/issues/11 2 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #836 (Div. 2)/A.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | s = raw_input() 5 | print s + s[::-1] 6 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #836 (Div. 2)/B.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | n = int(raw_input()) 5 | 6 | if n % 2 == 1: 7 | print ' '.join(map(str, [1] * n)) 8 | else: 9 | print ' '.join(map(str, 10 | [1, 3] + [2] * (n - 2))) 11 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #FF/A.py: -------------------------------------------------------------------------------- 1 | (p, n) = map(int, raw_input().split()) 2 | st = set() 3 | conflict = -1 4 | for i in xrange(n): 5 | v = int(raw_input()) % p 6 | if v in st: 7 | conflict = i + 1 # <= TEST 8 | break 9 | else: 10 | st.add(v) 11 | print conflict 12 | -------------------------------------------------------------------------------- /Codeforces/Codeforces Round #FF/B.py: -------------------------------------------------------------------------------- 1 | s = raw_input() 2 | k = int(raw_input()) 3 | values = map(int, raw_input().split()) 4 | ans = 0 5 | 6 | for i, c in enumerate(s): 7 | ans += (i + 1) * values[ord(c) - ord('a')] 8 | 9 | m = max(values) 10 | for i in xrange(len(s), len(s) + k): 11 | ans += (i + 1) * m 12 | print ans 13 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 14/A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input().split()) 3 | 4 | print 'YES' if sum(ns) == (n if n == 1 else n - 1) else 'NO' 5 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 27/A.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = sorted(map(int, raw_input().split())) 3 | 4 | a, b = ns[:n], ns[n:] 5 | 6 | print 'YES' if max(a) < min(b) else 'NO' 7 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 30/a.py: -------------------------------------------------------------------------------- 1 | (n, k, x) = map(int, raw_input().split()) 2 | ns = sorted(map(int, raw_input().split()), reverse=True) 3 | 4 | ans = 0 5 | for i in xrange(n): 6 | if i < k: 7 | ans += min(ns[i], x) 8 | else: 9 | ans += ns[i] 10 | print ans 11 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 30/b.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input()) 3 | 4 | d = {0: -1} 5 | ans = 0 6 | s = 0 7 | for i, num in enumerate(ns): 8 | s += 1 if num == 1 else -1 9 | if s in d: 10 | ans = max(ans, i - d[s]) 11 | else: 12 | d[s] = i 13 | 14 | print ans 15 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 33/B.py: -------------------------------------------------------------------------------- 1 | ns = [] 2 | 3 | for i in xrange(1000): 4 | u = ((2 ** i) - 1) * (2 ** (i - 1)) 5 | if u <= 10 ** 5: 6 | ns.append(u) 7 | else: 8 | break 9 | 10 | n = int(raw_input()) 11 | for num in ns[::-1]: 12 | if n % num == 0: 13 | print num 14 | break 15 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 5/B.py: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | 3 | res = -1 4 | 5 | for i in xrange(n): 6 | ns = map(int, raw_input().split()) 7 | res = max(res, min(ns)) 8 | 9 | print res 10 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 57/a.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | T := 0 7 | fmt.Scanf("%d\n", &T) 8 | 9 | for i := 0; i < T; i++ { 10 | l := 0 11 | r := 0 12 | fmt.Scanf("%d %d\n", &l, &r) 13 | 14 | fmt.Printf("%d %d\n", l, l * 2) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Codeforces/Educational Codeforces Round 83/A.py: -------------------------------------------------------------------------------- 1 | # https://codeforces.com/contest/1312/problem/A 2 | 3 | T = int(raw_input()) 4 | for case_ in xrange(T): 5 | (n, m) = map(int, raw_input().split()) 6 | print 'YES' if n % m == 0 else 'NO' 7 | -------------------------------------------------------------------------------- /Codeforces/Good Bye 2018/a.py: -------------------------------------------------------------------------------- 1 | def solve(a, b, c): 2 | b -= 1 3 | c -= 2 4 | return min(a, b, c) * 3 + 3 5 | 6 | assert solve(8, 13, 9) == 24 7 | assert solve(13, 3, 6) == 9 8 | assert solve(1, 2, 6) == 6 9 | 10 | (a, b, c) = map(int, raw_input().split()) 11 | print solve(a, b, c) 12 | -------------------------------------------------------------------------------- /Codeforces/Hello 2020/A.py: -------------------------------------------------------------------------------- 1 | n, m = map(int, raw_input().split()) 2 | 3 | ns = raw_input().split() 4 | ms = raw_input().split() 5 | 6 | q = int(raw_input()) 7 | 8 | for case_ in xrange(q): 9 | y = int(raw_input()) 10 | y -= 1 11 | nn = y % n 12 | mm = y % m 13 | 14 | print ns[nn] + ms[mm] 15 | -------------------------------------------------------------------------------- /Codewars/Find the unique number.py: -------------------------------------------------------------------------------- 1 | def find_uniq(arr): 2 | a, b = arr[0], arr[1] 3 | for item in arr[2:]: 4 | if item == a: 5 | continue 6 | elif item == b: 7 | a, b = b, a 8 | else: 9 | b = item 10 | return b 11 | -------------------------------------------------------------------------------- /Codewars/Number Pairs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | public class Kata 5 | { 6 | public static int [] getLargerNumbers(int [] a , int [] b) 7 | { 8 | return a.Zip(b, (_a, _b) => Math.Max(_a, _b)).ToArray(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Codewars/Number climber.py: -------------------------------------------------------------------------------- 1 | def climb(n): 2 | res = [] 3 | while n: 4 | res.append(n) 5 | n /= 2 6 | return res[::-1] 7 | -------------------------------------------------------------------------------- /Codewars/Number of trailing zeros of N!.py: -------------------------------------------------------------------------------- 1 | def zeros(n): 2 | u = 0 3 | v = 5 4 | while n / v: 5 | u += n / v 6 | v *= 5 7 | return u 8 | -------------------------------------------------------------------------------- /Codewars/Persistent Bugger.py: -------------------------------------------------------------------------------- 1 | def persistence(n): 2 | step = 0 3 | while n >= 10: 4 | n = reduce(lambda x, y: x * y, map(int, str(n))) 5 | step += 1 6 | return step 7 | -------------------------------------------------------------------------------- /Codewars/Playing on a chessboard.py: -------------------------------------------------------------------------------- 1 | def game(n): 2 | a = n * n 3 | if a % 2 == 0: 4 | return [a / 2] 5 | else: 6 | return [a, 2] 7 | -------------------------------------------------------------------------------- /Codewars/Powers of 2.fs: -------------------------------------------------------------------------------- 1 | let powersOfTwo n = [for i in 0 ..n do yield (1 <<< i)] 2 | -------------------------------------------------------------------------------- /Codewars/SQL Basics - Simple IN.sql: -------------------------------------------------------------------------------- 1 | SELECT id, name 2 | FROM departments 3 | WHERE 4 | id in ( SELECT department_id FROM sales WHERE price > 98.00 ) 5 | -------------------------------------------------------------------------------- /Codewars/Triangular Treasure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Kata 4 | { 5 | public static int Triangular(int n) 6 | { 7 | if (n < 0) 8 | return 0; 9 | 10 | return ((1 + n) * n) / 2; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Codewars/Valid Parentheses.py: -------------------------------------------------------------------------------- 1 | def valid_parentheses(string): 2 | u = 0 3 | for c in string: 4 | if c == '(': 5 | u += 1 6 | elif c == ')': 7 | u -= 1 8 | if u < 0: 9 | return False 10 | return u == 0 11 | -------------------------------------------------------------------------------- /Codility/Lesson02 Arrays/CyclicRotation.py: -------------------------------------------------------------------------------- 1 | def solution(A, K): 2 | if not A: 3 | return [] 4 | n = len(A) 5 | K %= n 6 | K = n - K 7 | return A[K:] + A[:K] 8 | -------------------------------------------------------------------------------- /Codility/Lesson02 Arrays/OddOccurrencesInArray.py: -------------------------------------------------------------------------------- 1 | def solution(A): 2 | return reduce(lambda x, y: x ^ y, A, 0) 3 | -------------------------------------------------------------------------------- /Codility/Lesson03 Time Complexity/FrogJmp.scala: -------------------------------------------------------------------------------- 1 | object Solution { 2 | def solution(x: Int, y: Int, d: Int): Int = { 3 | (y - x + d - 1) / d 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Codility/Lesson03 Time Complexity/PermMissingElem.py: -------------------------------------------------------------------------------- 1 | def solution(A): 2 | n = len(A) 3 | return sum(range(1, n + 2)) - sum(A) 4 | -------------------------------------------------------------------------------- /Codility/Lesson03 Time Complexity/Triangle.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int solution(vector &A) { 4 | int n = A.size(); 5 | sort(A.begin(), A.end()); 6 | for (int i = 0; i + 2 < n; i++) { 7 | if (1LL * A[i] + A[i + 1] > A[i + 2]) { 8 | return 1; 9 | } 10 | } 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Codility/Lesson06 Sorting/Distinct.py: -------------------------------------------------------------------------------- 1 | def solution(A): 2 | return len(set(A)) 3 | -------------------------------------------------------------------------------- /Codility/Lesson06 Sorting/MaxProductOfThree.py: -------------------------------------------------------------------------------- 1 | # you can write to stdout for debugging purposes, e.g. 2 | # print "this is a debug message" 3 | 4 | def solution(A): 5 | A.sort() 6 | 7 | return max( 8 | A[0] * A[1] * A[-1], 9 | A[-1] * A[-2] * A[-3] 10 | ) 11 | -------------------------------------------------------------------------------- /Codility/Lesson15 Caterpillar method/AbsDistinct.py: -------------------------------------------------------------------------------- 1 | def solution(A): 2 | return len(set(map(abs, A))) 3 | -------------------------------------------------------------------------------- /Exemplars/图论/2-SAT/README: -------------------------------------------------------------------------------- 1 | PRINT OK 2 | -------------------------------------------------------------------------------- /Exemplars/图论/最大流/README: -------------------------------------------------------------------------------- 1 | PRINT OK 2 | -------------------------------------------------------------------------------- /Exemplars/图论/连通分量/README: -------------------------------------------------------------------------------- 1 | PRINT OK 2 | -------------------------------------------------------------------------------- /Exemplars/字符串/README: -------------------------------------------------------------------------------- 1 | PRINT OK 2 | -------------------------------------------------------------------------------- /Exemplars/数学/Py高精度计算.py: -------------------------------------------------------------------------------- 1 | import decimal 2 | 3 | (a, b) = raw_input().split() 4 | 5 | decimal.getcontext().prec = 4000 6 | while a[-1] == '0': 7 | a = a[:-1] 8 | 9 | c = decimal.Decimal(a) ** decimal.Decimal(b) 10 | print '{0:f}'.format(c).replace('0.', '.') 11 | -------------------------------------------------------------------------------- /Exemplars/数学/高斯分布的概率积分.py: -------------------------------------------------------------------------------- 1 | import scipy.stats 2 | 3 | print scipy.stats.norm(30, 4).cdf(40) 4 | print 1.0 - scipy.stats.norm(30, 4).cdf(21) 5 | print scipy.stats.norm(30, 4).cdf(35) - scipy.stats.norm(30, 4).cdf(30) 6 | 7 | ''' 8 | 0.993790334674 9 | 0.987775527345 10 | 0.394350226333 11 | ''' 12 | -------------------------------------------------------------------------------- /Exemplars/数论/README: -------------------------------------------------------------------------------- 1 | PRINT OK 2 | -------------------------------------------------------------------------------- /Exemplars/数论/质数.cc: -------------------------------------------------------------------------------- 1 | 10007,100003,500009,1000003,23456789 2 | 3 | -------------------------------------------------------------------------------- /Exemplars/杂项/README: -------------------------------------------------------------------------------- 1 | PRINT OK 2 | -------------------------------------------------------------------------------- /Exemplars/杂项/枚举二进制状态子集.cc: -------------------------------------------------------------------------------- 1 | for (int i = 1; i < (1 << n); ++i) { 2 | for (int j = i; j; j = (j - 1) & i) { 3 | // ... 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Google Code Jam/Kickstart 2017/Kickstart Practice Round 2017/C.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | T = int(raw_input()) 3 | for case_ in xrange(T): 4 | print 'Case #%d:' % (case_ + 1), 5 | n, m = map(int, raw_input().split()) 6 | 7 | u = min(n, m) 8 | print u * (1 + u) / 2 9 | -------------------------------------------------------------------------------- /Google Code Jam/Qualification Round 2019/B.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | n = int(raw_input()) 5 | ns = raw_input() 6 | res = '' 7 | for m in ns: 8 | res += {'E': 'S', 'S': 'E'}[m] 9 | print 'Case #%d: %s' % (case_ + 1, res) 10 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Bit Manipulation/Flipping bits.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | for case_ in xrange(T): 3 | print (~(int(raw_input()))) & (0xFFFFFFFF) 4 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Bit Manipulation/Lonely Integer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/py 2 | def lonelyinteger(a): 3 | return reduce(lambda x, y: x ^ y, a, 0) 4 | 5 | if __name__ == '__main__': 6 | a = input() 7 | b = map(int, raw_input().strip().split(" ")) 8 | print lonelyinteger(b) 9 | 10 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Bit Manipulation/Sum vs XOR.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | 5 | 6 | n = long(raw_input().strip()) 7 | 8 | m = n 9 | while (m + 1) & m != 0: 10 | m |= (m >> 1) 11 | print 1 << '{:b}'.format(m ^ n).count('1') 12 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Dynamic-Programming/Fibonacci Modified.py: -------------------------------------------------------------------------------- 1 | a, b, n = map(int, raw_input().split()) 2 | 3 | for i in xrange(n - 1): 4 | a, b = b, a + b * b 5 | 6 | print a 7 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Game Theory/Introduction to Nim Game.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | T = int(raw_input()) 3 | for case_ in xrange(T): 4 | n = int(raw_input()) 5 | ns = map(int, raw_input().split()) 6 | 7 | print 'First' if reduce(lambda x, y: x ^ y, ns) else 'Second' 8 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Greedy/Priyanka and Toys.py: -------------------------------------------------------------------------------- 1 | INF = 0x3f3f3f3f 2 | 3 | n = int(raw_input()) 4 | ns = sorted(map(int, raw_input().split())) 5 | 6 | ans = 0 7 | flag = -INF 8 | for num in ns: 9 | if num > flag: 10 | flag = num + 4 11 | ans += 1 12 | print ans 13 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Implementation/Jim and the Orders.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = [] 3 | for i in xrange(n): 4 | u, d = map(int, raw_input().split()) 5 | ns.append(u + d) 6 | 7 | print ' '.join(map(lambda (i, n): str(i + 1), sorted(enumerate(ns), key=lambda x: x[1]))) 8 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Implementation/Repeated String.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | 5 | 6 | s = raw_input().strip() 7 | n = long(raw_input().strip()) 8 | l = len(s) 9 | 10 | print s.count('a') * (n / l) + s[:n % l].count('a') 11 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Implementation/Sequence Equation.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input().split()) 3 | 4 | d = {} 5 | 6 | for i in xrange(n): 7 | u = ns[i] 8 | d[u] = i 9 | 10 | for i in xrange(n): 11 | u = d[i + 1] 12 | v = d[u + 1] 13 | print v + 1 14 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Implementation/The Hurdle Race.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | 5 | 6 | n,k = raw_input().strip().split(' ') 7 | n,k = [int(n),int(k)] 8 | height = map(int, raw_input().strip().split(' ')) 9 | 10 | print max(0, max(height) - k) 11 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Sorting/Counting Sort 1.py: -------------------------------------------------------------------------------- 1 | N = 100 2 | 3 | n = int(raw_input()) 4 | ns = map(int, raw_input().split()) 5 | ms = [0 for i in xrange(N)] 6 | 7 | for i in ns: 8 | ms[i] += 1 9 | 10 | print ' '.join(map(str, ms)) 11 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Strings/CamelCase.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | import re 5 | 6 | s = raw_input().strip() 7 | 8 | print len(re.findall('[A-Z]', s)) + 1 9 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Strings/Game of Thrones - I.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | s = raw_input() 4 | 5 | cnt = 0 6 | for key, value in Counter(s).items(): 7 | if value % 2: 8 | cnt += 1 9 | 10 | print 'YES' if cnt <= 1 else 'NO' 11 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Strings/Gem Stones.py: -------------------------------------------------------------------------------- 1 | import string 2 | 3 | n = int(raw_input()) 4 | 5 | res = set(string.ascii_lowercase) 6 | for i in xrange(n): 7 | u = set(raw_input()) 8 | res &= u 9 | print len(res) -------------------------------------------------------------------------------- /HackerRank/Algorithms/Strings/Pangrams.py: -------------------------------------------------------------------------------- 1 | print 'pangram' if len(set(''.join(raw_input().lower().split()))) == 26 else 'not pangram' 2 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/Strings/Two Strings.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | a = set(list(raw_input())) 5 | b = set(list(raw_input())) 6 | 7 | if a & b: 8 | print 'YES' 9 | else: 10 | print 'NO' -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Angry Children.py: -------------------------------------------------------------------------------- 1 | n = input() 2 | k = input() 3 | candies = [input() for _ in range(0,n)] 4 | candies.sort() 5 | min_diff = min([candies[i + k - 1] - candies[i] for i in xrange(n - k + 1)]) 6 | 7 | print min_diff 8 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Cut the sticks.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = sorted(map(int, raw_input().split())) 3 | 4 | pre = -1 5 | cnt = 0 6 | 7 | for num in ns: 8 | if pre == num: 9 | cnt += 1 10 | else: 11 | print n - cnt 12 | n -= cnt 13 | cnt = 1 14 | pre = num 15 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Extra long factorials.py: -------------------------------------------------------------------------------- 1 | print reduce(lambda x, y: x * y, range(1, int(raw_input()) + 1), 1) 2 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Filling Jars.cc: -------------------------------------------------------------------------------- 1 | (n, m) = map(int, raw_input().split()) 2 | 3 | s = 0 4 | for i in xrange(m): 5 | (a, b, c) = map(int, raw_input().split()) 6 | s += (b - a + 1) * c 7 | print s / n 8 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Find Digits.py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STDOUT 2 | 3 | n = int(raw_input()) 4 | 5 | for i in xrange(n): 6 | u = raw_input() 7 | print len( 8 | filter(lambda x: x != 0 and int(u) % x == 0, 9 | map(int, list(u)) 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Simple Array Sum.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | 5 | 6 | n = int(raw_input().strip()) 7 | arr = map(int,raw_input().strip().split(' ')) 8 | print sum(arr) 9 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Solve Me First.lua: -------------------------------------------------------------------------------- 1 | solveMeFirst = function(a,b) 2 | return a + b 3 | end 4 | 5 | 6 | a = io.read("*number") 7 | b = io.read("*number") 8 | res = solveMeFirst(a,b) 9 | print (res) 10 | -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/Staircase.lua: -------------------------------------------------------------------------------- 1 | n = io.read("*number", "*l") 2 | 3 | for i = 1, n do 4 | print (string.rep(" ", n - i) .. string.rep("#", i)) 5 | end -------------------------------------------------------------------------------- /HackerRank/Algorithms/WarmUp/The Love-Letter Mystery.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | for i in xrange(n): 4 | num = raw_input() 5 | left, right = num[:len(num) / 2], num[(len(num) + 1) / 2:][::-1] 6 | print sum(map(lambda (x, y): abs(ord(x) - ord(y)), zip(left, right))) 7 | -------------------------------------------------------------------------------- /HackerRank/All Contests/HourRank 31/Hanging Posters.py: -------------------------------------------------------------------------------- 1 | (n, h) = map(int, raw_input().split()) 2 | 3 | ws = map(int, raw_input().split()) 4 | ls = map(int, raw_input().split()) 5 | 6 | res = 0 7 | 8 | for i in xrange(n): 9 | u = (ws[i] - 0.25 * ls[i]) - h 10 | res = max(u, res) 11 | 12 | print int(res + 0.99) 13 | -------------------------------------------------------------------------------- /HackerRank/All Contests/ProjectEuler+/006.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | 5 | 6 | t = int(raw_input().strip()) 7 | for a0 in xrange(t): 8 | n = int(raw_input().strip()) 9 | print (sum(range(n + 1)) ** 2) - sum(map(lambda x: x ** 2, range(n + 1))) 10 | -------------------------------------------------------------------------------- /HackerRank/All Contests/ProjectEuler+/013.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | 3 | print str(sum(map(int, [raw_input() for i in xrange(n)])))[:10] 4 | -------------------------------------------------------------------------------- /HackerRank/All Contests/ProjectEuler+/016.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | for case_ in xrange(T): 3 | n = int(raw_input()) 4 | print sum(map(int, str(2 ** n))) 5 | -------------------------------------------------------------------------------- /HackerRank/All Contests/ProjectEuler+/020.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | T = int(raw_input()) 3 | for case_ in xrange(T): 4 | n = int(raw_input()) 5 | print sum(map(int, str(reduce(lambda x, y: x * y, range(1, n + 1), 1)))) 6 | -------------------------------------------------------------------------------- /HackerRank/All Contests/ProjectEuler+/021.py: -------------------------------------------------------------------------------- 1 | f = [220,284,1184,1210,2620,2924,5020,5564,6232,6368,10744, 10856,12285,14595,17296,18416,63020,66928,66992,67095, 69615,71145,76084,79750,87633,88730] 2 | 3 | T = int(raw_input()) 4 | for case_ in xrange(T): 5 | n = int(raw_input()) 6 | print sum(filter(lambda x: x < n, f)) 7 | -------------------------------------------------------------------------------- /HackerRank/Data Structures/Arrays/Sparse Arrays.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | n = int(raw_input()) 4 | 5 | d = {} 6 | 7 | for i in xrange(n): 8 | s = raw_input() 9 | d[s] = d.get(s, 0) + 1 10 | 11 | q = int(raw_input()) 12 | 13 | for i in xrange(q): 14 | s = raw_input() 15 | print d.get(s, 0) -------------------------------------------------------------------------------- /HackerRank/Data Structures/Linked Lists/Insert a Node at the Tail of a Linked List.py: -------------------------------------------------------------------------------- 1 | def Insert(head, data): 2 | dummy_head = Node(-1) 3 | dummy_head.next = head 4 | head = dummy_head 5 | while head.next: 6 | head = head.next 7 | head.next = Node(data) 8 | return dummy_head.next 9 | -------------------------------------------------------------------------------- /HackerRank/Data Structures/Linked Lists/Print the Elements of a Linked List.py: -------------------------------------------------------------------------------- 1 | def print_list(head): 2 | while head: 3 | print head.data 4 | head = head.next 5 | -------------------------------------------------------------------------------- /HackerRank/Databases/Relational-Algebra/Basics of Sets and Relations #1.txt: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Hello World N Times.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | [] 4 | let main argv = 5 | let n = Console.ReadLine() |> int 6 | for i in 1 .. n do 7 | printfn "Hello World" 8 | 0 9 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Hello World.erl: -------------------------------------------------------------------------------- 1 | % Enter your code here. Read input from STDIN. Print output to STDOUT 2 | % Your class should be named solution 3 | 4 | -module(solution). 5 | -export([main/0]). 6 | 7 | main() -> 8 | io:format("Hello World"). 9 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Lambda Calculus - Reductions #1.txt: -------------------------------------------------------------------------------- 1 | y 2 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Lambda Calculus - Reductions #2.txt: -------------------------------------------------------------------------------- 1 | w 2 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Lambda Calculus - Reductions #3.txt: -------------------------------------------------------------------------------- 1 | CAN'T REDUCE 2 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Lambda Calculus - Reductions #4.txt: -------------------------------------------------------------------------------- 1 | CAN'T REDUCE 2 | -------------------------------------------------------------------------------- /HackerRank/Functional Programming/Introduction/Solve Me First FP.fs: -------------------------------------------------------------------------------- 1 | open System 2 | 3 | [] 4 | let main argv = 5 | let a = Console.ReadLine() |> int 6 | let b = Console.ReadLine() |> int 7 | printfn "%d" (a+b) 8 | 0 // return an integer exit code 9 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/A Personalized Echo.sh: -------------------------------------------------------------------------------- 1 | read name 2 | echo "Welcome $name" -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Arithmetic Operations.sh: -------------------------------------------------------------------------------- 1 | read exp 2 | printf "%.3f" $(echo $exp | bc -l) -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Comparing Numbers.sh: -------------------------------------------------------------------------------- 1 | read a 2 | read b 3 | 4 | if (( a < b )); then 5 | echo "X is less than Y" 6 | elif (( a > b )); then 7 | echo "X is greater than Y" 8 | else 9 | echo "X is equal to Y" 10 | fi -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Compute the Average.sh: -------------------------------------------------------------------------------- 1 | read n 2 | awk '{ total += $0; count++ } END { printf("%.3f", total/count) }' -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Getting started with conditionals.sh: -------------------------------------------------------------------------------- 1 | read a 2 | 3 | if [[ $a == 'Y' || $a == 'y' ]]; then 4 | echo 'YES' 5 | else 6 | echo 'NO' 7 | fi -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Lets Echo.sh: -------------------------------------------------------------------------------- 1 | echo "HELLO" -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Looping and Skipping.sh: -------------------------------------------------------------------------------- 1 | for i in {1..100..2} 2 | do 3 | echo $i 4 | done -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Looping with Numbers.sh: -------------------------------------------------------------------------------- 1 | for i in {1..50} 2 | do 3 | echo $i 4 | done -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/More on Conditionals.sh: -------------------------------------------------------------------------------- 1 | read a 2 | read b 3 | read c 4 | 5 | if (( a == b && b == c )); then 6 | echo "EQUILATERAL" 7 | elif (( a == b || b == c )); then 8 | echo "ISOSCELES" 9 | else 10 | echo "SCALENE" 11 | fi -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Read in an Array.sh: -------------------------------------------------------------------------------- 1 | xargs -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/Slice an Array.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while read arr[$i]; do 3 | i=$(( i + 1)) 4 | done 5 | echo ${arr[@]:3:5} -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Bash/The World of Numbers.sh: -------------------------------------------------------------------------------- 1 | read a 2 | read b 3 | echo $[$a+$b] 4 | echo $[$a-$b] 5 | echo $[$a*$b] 6 | echo $[$a/$b] -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Awk' - 1.sh: -------------------------------------------------------------------------------- 1 | awk 'NF != 4 { print "Not all scores are available for " $1 }' 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Awk' - 2.sh: -------------------------------------------------------------------------------- 1 | awk '{ 2 | ave = ($2 + $3 + $4) / 3.0 3 | if (ave >= 60) 4 | print $1 " : Pass" 5 | else 6 | print $1 " : Fail" 7 | }' 8 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Awk' - 4.sh: -------------------------------------------------------------------------------- 1 | paste - - -d ";" 2 | 3 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Grep' #1.sh: -------------------------------------------------------------------------------- 1 | grep "\bthe\b" 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Grep' #2.sh: -------------------------------------------------------------------------------- 1 | grep -i "\bthe\b" 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Grep' #3.sh: -------------------------------------------------------------------------------- 1 | grep -i that -v 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/'Grep' - A.sh: -------------------------------------------------------------------------------- 1 | grep -iw "the\|that\|then\|those" 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Grep Sed Awk/Awk - 3.sh: -------------------------------------------------------------------------------- 1 | awk '{ 2 | ave = ($2 + $3 + $4) / 3.0 3 | 4 | if (ave >= 80) 5 | print $0 " : A" 6 | else if (ave >= 60) 7 | print $0 " : B" 8 | else 9 | print $0 " : FAIL" 10 | }' 11 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/'Sort' command #6.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort -k2 -n -t $'\t' -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/'Sort' command #7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort -k2 -n -r -t'|' -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/'Tr' Command #3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tr -s " " -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/'Uniq' command #3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uniq -ci | sed "s/^[[:space:]]*//g" -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/'Uniq' command #4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uniq -u -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Cut #4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -c -4 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Cut #5.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -f 1-3 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Cut #6.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -c 13- -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Cut #7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -f 4 -d " " -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Cut #8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -f -3 -d " " -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Cut #9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -f 2- -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 1: Cut #1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -c 3 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 1: Cut #2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -c 2,7 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 1: Cut #3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -c 2-7 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 2: Head of a Text File #1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | head -n 20 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 2: Head of a Text File #2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | head -c 20 -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 2: Tail of a Text File #1.sh: -------------------------------------------------------------------------------- 1 | tail -n 20 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 2: Tail of a Text File #2.sh: -------------------------------------------------------------------------------- 1 | tail -c 20 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 3: 'Tr' Command #1.sh: -------------------------------------------------------------------------------- 1 | tr "()" "[]" 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 3: 'Tr' Command #2.sh: -------------------------------------------------------------------------------- 1 | tr -d "[a-z]" 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 3: Sort Command #1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 3: Sort Command #2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort -r -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 4: 'Uniq' Command #1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uniq -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 4: 'Uniq' Command #2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uniq -c | sed "s/^[[:space:]]*//g" -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Day 4: Paste - 2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | paste -d';' - - - -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Middle of A Text File.sh: -------------------------------------------------------------------------------- 1 | head -n 22 | tail -11 2 | -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Paste - 1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | paste -s -d';' -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Paste - 3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tr '\n' ' ' -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Paste - 4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | paste - - - -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Sort Command #4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort -n -r -------------------------------------------------------------------------------- /HackerRank/Linux Shell/Text Processing/Sort Command #5.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort -k 2 -n -r -t $'\t' -------------------------------------------------------------------------------- /HackerRank/Mathematics/Algebra/Tell the Average.py: -------------------------------------------------------------------------------- 1 | MOD = 1000000007 2 | 3 | n = int(raw_input()) 4 | ns = map(int, raw_input().split()) 5 | 6 | p = ns.pop() 7 | while ns: 8 | q = ns.pop() 9 | p = p + q + p * q 10 | p %= MOD 11 | print p 12 | -------------------------------------------------------------------------------- /HackerRank/Mathematics/Fundamentals/Find Point.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | (x1, y1, x2, y2) = map(int, raw_input().split()) 5 | x3 = x2 + (x2 - x1) 6 | y3 = y2 + (y2 - y1) 7 | print x3, y3 8 | -------------------------------------------------------------------------------- /HackerRank/Mathematics/Fundamentals/Halloween party.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | 3 | for case_ in xrange(T): 4 | n = int(raw_input()) 5 | k = n / 2 6 | print k * (n - k) 7 | -------------------------------------------------------------------------------- /HackerRank/Mathematics/Fundamentals/Is Fibo.py: -------------------------------------------------------------------------------- 1 | MAXI = (10 ** 10) + 123456 2 | 3 | a, b = 1, 1 4 | s = set() 5 | 6 | while a < MAXI: 7 | s.add(a) 8 | a, b = b, a + b 9 | 10 | T = int(raw_input()) 11 | for case_ in xrange(T): 12 | x = int(raw_input()) 13 | print 'IsFibo' if x in s else 'IsNotFibo' 14 | -------------------------------------------------------------------------------- /HackerRank/Mathematics/Fundamentals/Restaurant.py: -------------------------------------------------------------------------------- 1 | def gcd(a, b): 2 | if a % b == 0: 3 | return b 4 | else: 5 | return gcd(b, a % b) 6 | 7 | T = int(raw_input()) 8 | for case_ in xrange(T): 9 | (a, b) = map(int, raw_input().split()) 10 | g = gcd(a, b) 11 | print a * b / g / g 12 | -------------------------------------------------------------------------------- /HackerRank/Mathematics/Linear Algebra Foundations/Linear Algebra Foundations #1 - Matrix Addition.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 7 3 | 9 4 | 9 5 | 11 6 | 13 7 | 5 8 | 6 9 | 8 -------------------------------------------------------------------------------- /HackerRank/Mathematics/Linear Algebra Foundations/Linear Algebra Foundations #2 - Matrix Subtraction.txt: -------------------------------------------------------------------------------- 1 | -3 2 | -3 3 | -3 4 | -5 5 | -5 6 | -5 7 | -3 8 | -4 9 | 1 -------------------------------------------------------------------------------- /HackerRank/Mathematics/Probability/Day 4: Normal Distribution #1.py: -------------------------------------------------------------------------------- 1 | import scipy.stats 2 | 3 | print scipy.stats.norm(30, 4).cdf(40) 4 | print 1.0 - scipy.stats.norm(30, 4).cdf(21) 5 | print scipy.stats.norm(30, 4).cdf(35) - scipy.stats.norm(30, 4).cdf(30) 6 | 7 | ''' 8 | 0.993790334674 9 | 0.987775527345 10 | 0.394350226333 11 | ''' 12 | -------------------------------------------------------------------------------- /HackerRank/Python/Introduction/Python If-Else.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import math 4 | import os 5 | import random 6 | import re 7 | import sys 8 | 9 | if __name__ == '__main__': 10 | n = int(raw_input().strip()) 11 | 12 | if n % 2 == 1 or 6 <= n <= 20: 13 | print 'Weird' 14 | else: 15 | print 'Not Weird' 16 | -------------------------------------------------------------------------------- /HackerRank/Python/Sets/Introduction to Sets.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | 3 | def average(array): 4 | s = set(array) 5 | return 1.0 * sum(s) / len(s) 6 | 7 | if __name__ == '__main__': 8 | n = int(raw_input()) 9 | arr = map(int, raw_input().split()) 10 | result = average(arr) 11 | print result 12 | -------------------------------------------------------------------------------- /HackerRank/Python/Strings/String Split and Join.py: -------------------------------------------------------------------------------- 1 | def split_and_join(line): 2 | return '-'.join(line.split()) 3 | 4 | if __name__ == '__main__': 5 | line = raw_input() 6 | result = split_and_join(line) 7 | print result 8 | -------------------------------------------------------------------------------- /HackerRank/Python/Strings/sWAP cASE.py: -------------------------------------------------------------------------------- 1 | def swap_case(s): 2 | return ''.join(map(lambda x: x.lower() if x.isupper() else x.upper(), s)) 3 | 4 | if __name__ == '__main__': 5 | s = raw_input() 6 | result = swap_case(s) 7 | print result 8 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/Building a Smart IDE: Identifying comments.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | 4 | code = sys.stdin.read() 5 | 6 | g = re.findall("((?://.*)|(?:/\*[.\s\S]*?\*/))", code) 7 | for snippet in g: 8 | for line in snippet.split('\n'): 9 | print line.strip() 10 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/Detect HTML links.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | 4 | html = sys.stdin.read() 5 | g = re.findall("(?:<.*?>)?(.*?)(?:<.*?>)?", html) 6 | for (href, text) in g: 7 | print '%s,%s' % (href, text.strip()) 8 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/Detect the Email Addresses.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | 4 | emails = [] 5 | 6 | for line in sys.stdin: 7 | g = re.findall("([\w._]+@\w+\.\w+(?:\.\w+)*)", line) 8 | emails += g 9 | print ';'.join(sorted(set(emails))) 10 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/HackerRank Tweets.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | print len(filter(lambda x: 'hackerrank' in x, [raw_input().lower() for i in xrange(n)])) 3 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/Saying Hi.py: -------------------------------------------------------------------------------- 1 | import re 2 | import sys 3 | 4 | n = int(raw_input()) 5 | 6 | for line in sys.stdin: 7 | line = line.strip() 8 | if re.search(r'^[Hh][Ii] [^Dd]', line): 9 | print line 10 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/Utopian Identification Number.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | n = int(raw_input()) 4 | for i in xrange(n): 5 | s = raw_input() 6 | if re.search("^[a-z]{0,3}[\d]{2,8}[A-Z]{3,}", s): 7 | print 'VALID' 8 | else: 9 | print 'INVALID' 10 | -------------------------------------------------------------------------------- /HackerRank/Regex/Applications/Valid PAN format.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | n = int(raw_input()) 4 | for i in xrange(n): 5 | s = raw_input().strip() 6 | if re.match("^[A-Z]{5}\d{4}[A-Z]$", s): 7 | print 'YES' 8 | else: 9 | print 'NO' 10 | -------------------------------------------------------------------------------- /HackerRank/Regex/Backreferences/Backreferences To Failed Groups.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r"^(\d{2})(-?)(\d{2})\2(\d{2})\2(\d{2})$" # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Backreferences/Branch Reset Groups.php: -------------------------------------------------------------------------------- 1 | $Regex_Pattern = '/^\d\d(?|(-)|(---)|(\.)|(\:))\d\d\1\d\d\1\d\d$/'; //Do not delete '/'. Replace __________ with your regex. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Backreferences/Forward References.php: -------------------------------------------------------------------------------- 1 | $Regex_Pattern = '/^(\2tic|(tac))+$/'; //Do not delete '/'. Replace __________ with your regex. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Backreferences/Matching Same Text Again & Again.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^([a-z])(\w)(\s)(\W)(\d)(\D)([A-Z])([a-zA-Z])([aeiouAEIOU])(\S)\1\2\3\4\5\6\7\8\9\10$' 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Character Class/Excluding Specific Characters.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^[^\d][^aeiou][^bcDF]\S[^AEIOU][^.,]$' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Character Class/Matching Character Ranges.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^[a-z][1-9][^a-z][^A-Z][A-Z]' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Character Class/Matching Specific Characters.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^[123][120][xs0][30Aa][xsu][.,]$' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Grouping and Capturing/Alternative Matching.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^(Mr\.|Mrs\.|Ms\.|Dr\.|Er\.)[a-zA-Z]+$' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Grouping and Capturing/Capturing & Non-Capturing Groups.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'(ok){3,}' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Grouping and Capturing/Matching Word Boundaries.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'\b[aeiouAEIOU][a-zA-Z]*\b' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Introduction/ Matching Start & End.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r"^\d\w{4}\.$" # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Introduction/Matching Anything But a Newline.py: -------------------------------------------------------------------------------- 1 | regex_pattern = r"^.{3}\..{3}\..{3}\..{3}$" # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Introduction/Matching Digits & Non-Digit Characters.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r"\d{2}\D\d{2}\D\d{4}" # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Introduction/Matching Specific String.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'hackerrank' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Introduction/Matching Whitespace & Non-Whitespace Character.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'(\S{2}\s){2}\S{2}' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Introduction/Matching Word & Non-Word Character.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r"\w{3}\W\w{10}\W\w{3}" # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Repetitions/Matching Ending Items.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^[a-zA-Z]*s$' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Repetitions/Matching One Or More Repetitions.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^\d+[A-Z]+[a-z]+$' # Do not delete 'r'. 2 | 3 | -------------------------------------------------------------------------------- /HackerRank/Regex/Repetitions/Matching Zero Or More Repetitions.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^\d{2,}[a-z]*[A-Z]*$' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Repetitions/Matching {x, y} Repetitions.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^\d{1,2}[a-zA-Z]{3,}\.{0,3}$' 2 | -------------------------------------------------------------------------------- /HackerRank/Regex/Repetitions/Matching {x} Repetitions.py: -------------------------------------------------------------------------------- 1 | Regex_Pattern = r'^[a-zA-Z24680]{40}[13579\s]{5}$' # Do not delete 'r'. 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Advanced-Select/The PADS.sql: -------------------------------------------------------------------------------- 1 | SELECT CONCAT(Name, "(", LEFT(Occupation, 1), ")") FROM OCCUPATIONS ORDER BY Name; 2 | SELECT CONCAT("There are total ", COUNT(*), " ", LOWER(Occupation), "s.") FROM OCCUPATIONS GROUP BY Occupation ORDER BY COUNT(*), LOWER(Occupation); 3 | -------------------------------------------------------------------------------- /HackerRank/SQL/Aggregation/Average Population.sql: -------------------------------------------------------------------------------- 1 | select FLOOR(AVG(population)) from CITY; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Aggregation/Japan Population.sql: -------------------------------------------------------------------------------- 1 | SELECT SUM(POPULATION) FROM CITY WHERE COUNTRYCODE="JPN"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Aggregation/Population Density Difference.sql: -------------------------------------------------------------------------------- 1 | SELECT MAX(POPULATION) - MIN(POPULATION) FROM CITY; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Aggregation/Revising Aggregations - Averages.sql: -------------------------------------------------------------------------------- 1 | SELECT AVG(POPULATION) FROM CITY WHERE DISTRICT = "California"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Aggregation/Revising Aggregations - The Count Function.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT(*) FROM CITY WHERE POPULATION > 100000; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Aggregation/Revising Aggregations - The Sum Function.sql: -------------------------------------------------------------------------------- 1 | SELECT SUM(POPULATION) FROM CITY WHERE DISTRICT="California"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Employee Names.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM Employee ORDER BY name; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Employee Salaries.sql: -------------------------------------------------------------------------------- 1 | SELECT name from EMPLOYEE WHERE salary > 2000 and months < 10; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Higher Than 75 Marks.sql: -------------------------------------------------------------------------------- 1 | SELECT NAME FROM STUDENTS WHERE Marks > 75 ORDER BY RIGHT(NAME, 3), ID; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Japanese Cities' Detail.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM CITY WHERE COUNTRYCODE="JPN"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Japanese Cities' Name.sql: -------------------------------------------------------------------------------- 1 | SELECT NAME FROM CITY WHERE COUNTRYCODE="JPN"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Revising the Select Query - 1.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM CITY 2 | WHERE COUNTRYCODE="USA" AND POPULATION > 100000; 3 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Revising the Select Query - 2.sql: -------------------------------------------------------------------------------- 1 | SELECT NAME FROM CITY 2 | WHERE COUNTRYCODE="USA" AND POPULATION > 120000; 3 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Select All.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM CITY; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Select by ID.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM CITY WHERE ID = 1661; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 1.sql: -------------------------------------------------------------------------------- 1 | SELECT CITY, STATE from STATION; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 10.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP ".*[^aeiou]$"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 11.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "(^[^aeiou])|([^aeiou]$)"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 12.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^[^aeiou].*[^aeiou]$"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 3.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT(CITY) FROM STATION WHERE ID % 2 = 0; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 4.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT(*) - COUNT(DISTINCT(CITY)) FROM STATION; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 5.sql: -------------------------------------------------------------------------------- 1 | (SELECT CITY, LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY) LIMIT 1) 2 | UNION ALL 3 | (SELECT CITY, LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY) DESC LIMIT 1); 4 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 6.sql: -------------------------------------------------------------------------------- 1 | SELECT CITY FROM STATION WHERE CITY REGEXP '^[aeiou]'; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 7.sql: -------------------------------------------------------------------------------- 1 | SELECT CITY, STATE from STATION; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 8.sql: -------------------------------------------------------------------------------- 1 | SELECT CITY FROM STATION WHERE CITY REGEXP "^[aeiou].*[aeiou]$"; 2 | -------------------------------------------------------------------------------- /HackerRank/SQL/Basic-Select/Weather Observation Station 9.sql: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^[^aeiou]"; 2 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Javascript/Day 1: Functions.js: -------------------------------------------------------------------------------- 1 | function factorial(n) { 2 | var res = 1; 3 | for (var i = 1; i <= n; i++) { 4 | res *= i; 5 | } 6 | return res; 7 | } 8 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Javascript/Day 2: Conditional Statements: If-Else.js: -------------------------------------------------------------------------------- 1 | function getGrade(score) { 2 | let grade; 3 | 4 | score = Math.max(0, score - 1); 5 | 6 | return "FEDCBA"[Math.floor(score / 5)]; 7 | } 8 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Statistics/Day 0: Mean, Median, and Mode.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from scipy import stats 3 | 4 | n = int(raw_input()) 5 | ns = map(int, raw_input().split()) 6 | 7 | print "%.1f" % numpy.mean(ns) 8 | print "%.1f" % numpy.median(ns) 9 | print "%d" % stats.mode(ns)[0] 10 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Statistics/Day 0: Weighted Mean.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ns = map(int, raw_input().split()) 3 | ms = map(int, raw_input().split()) 4 | print '%.1f' % (1.0 * sum(map(lambda (x, y): x * y, zip(ns, ms))) / sum(ms)) 5 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Statistics/Day 1: Standard Deviation.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | n = int(raw_input()) 4 | ns = map(int, raw_input().split()) 5 | 6 | ave = 1.0 * sum(ns) / n 7 | print math.sqrt(sum(map(lambda x: abs(x - ave) ** 2, ns)) / n) 8 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Statistics/Day 4: Geometric Distribution I.py: -------------------------------------------------------------------------------- 1 | (a, b) = map(int, raw_input().split()) 2 | n = int(raw_input()) 3 | 4 | p = 1.0 * a / b 5 | q = 1 - p 6 | 7 | print '%.3f' % ((q ** 4) * (p)) 8 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Statistics/Day 4: Geometric Distribution II.py: -------------------------------------------------------------------------------- 1 | (a, b) = map(int, raw_input().split()) 2 | n = int(raw_input()) 3 | 4 | p = 1.0 * a / b 5 | q = 1 - p 6 | 7 | print '%.3f' % (1 - q ** 5) 8 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/10 Days of Statistics/Day 5: Poisson Distribution I.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | la = float(raw_input()) 4 | k = int(raw_input()) 5 | 6 | P = (math.e ** -la) * (la ** k) / math.factorial(k) 7 | 8 | print '%.3f' % P 9 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/30-Days-of-Code/Day 0: Hello, World.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | "fmt" 6 | "bufio" 7 | ) 8 | 9 | func main() { 10 | cin := bufio.NewReader(os.Stdin) 11 | line, _, _ := cin.ReadLine() 12 | fmt.Println("Hello, World.") 13 | fmt.Println(string(line)) 14 | } 15 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/30-Days-of-Code/Day 16: Exceptions - String to Integer.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | 5 | 6 | S = raw_input().strip() 7 | 8 | try: 9 | print int(S) 10 | except: 11 | print 'Bad String' 12 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/30-Days-of-Code/Day 5: Loops.go: -------------------------------------------------------------------------------- 1 | package main 2 | import "fmt" 3 | 4 | func main() { 5 | x := 0 6 | fmt.Scanf("%d", &x) 7 | 8 | for i := 1; i <= 10; i++ { 9 | fmt.Printf("%d x %d = %d\n", x, i, x * i) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /HackerRank/Tutorials/30-Days-of-Code/Day 9: Recursion.go: -------------------------------------------------------------------------------- 1 | package main 2 | import "fmt" 3 | 4 | func factorial(n int) int { 5 | if n == 0 { 6 | return 1 7 | } 8 | return n * factorial(n - 1) 9 | } 10 | 11 | func main() { 12 | n := 0 13 | fmt.Scanf("%d", &n) 14 | fmt.Println(factorial(n)) 15 | } 16 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00055-Jump Game.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | bool canJump(int A[], int n) { 4 | int cover = 0; 5 | for (int i = 0; i <= cover && i < n; i++) { 6 | cover = max(cover, i + A[i]); 7 | } 8 | return (cover >= n - 1); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00136-Single Number.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int singleNumber(int A[], int n) { 4 | int res = 0; 5 | for (int i = 0; i < n; i++) { 6 | res ^= A[i]; 7 | } 8 | return res; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00191-Number of 1 Bits.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int hammingWeight(uint32_t n) { 4 | int ans = 0; 5 | while (n) { 6 | ans += n & 1; 7 | n >>= 1; 8 | } 9 | return ans; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00231-Power of Two.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | bool isPowerOfTwo(int n) { 4 | return n > 0 && (n & (n - 1)) == 0; 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00258-Add Digits.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int addDigits(int num) { 4 | if (num == 0) { 5 | return 0; 6 | } 7 | int x = num % 9; 8 | return x == 0? 9: x; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00292-Nim Game.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | bool canWinNim(int n) { 4 | return n & 3; 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00319-Bulb Switcher.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int bulbSwitch(int n) { 4 | return sqrt(n); 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00342-Power of Four.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | bool isPowerOfFour(int num) { 4 | return (num & (num - 1)) == 0 && (num & 0x55555555); 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00344-Reverse String.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | string reverseString(string s) { 4 | reverse(s.begin(), s.end()); 5 | return s; 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00371-Sum of Two Integers.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int getSum(int a, int b) { 4 | while (b) { 5 | int c = a & b; 6 | int d = a ^ b; 7 | a = d; 8 | b = c << 1; 9 | } 10 | return a; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/cpp/00389-Find the Difference.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | char findTheDifference(string s, string t) { 4 | return accumulate(t.begin(), t.end(), 0) - accumulate(s.begin(), s.end(), 0); 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/golang/00283-Move Zeroes.go: -------------------------------------------------------------------------------- 1 | func moveZeroes(nums []int) { 2 | n := len(nums); 3 | p := 0; 4 | for i := 0; i < n; i++ { 5 | if nums[i] != 0 { 6 | nums[p], nums[i] = nums[i], nums[p] 7 | p++; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00049-Group Anagrams.py: -------------------------------------------------------------------------------- 1 | from itertools import groupby 2 | 3 | class Solution(object): 4 | def groupAnagrams(self, strs): 5 | strkey = lambda s: ''.join(sorted(s)) 6 | return [list(g) for (_, g) in groupby(sorted(strs, key=strkey), strkey)] 7 | 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00058-Length of Last Word.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @param s, a string 3 | # @return an integer 4 | def lengthOfLastWord(self, s): 5 | return len(s.split()[-1]) if s.strip() else 0 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00062-Unique Paths.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @return an integer 3 | def uniquePaths(self, m, n): 4 | ans = 1 5 | m -= 1 6 | n -= 1 7 | for i in xrange(min(m, n)): 8 | ans *= (m + n - i) 9 | ans /= i + 1 10 | return ans 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00081-Search in Rotated Sorted Array II.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @param A a list of integers 3 | # @param target an integer 4 | # @return a boolean 5 | def search(self, A, target): 6 | return target in A 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00125-Valid Palindrome.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | class Solution(object): 4 | def isPalindrome(self, s): 5 | s = ''.join(re.split("[^0-9a-zA-Z]", s)).lower() 6 | return s == s[::-1] 7 | 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00136-Single Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def singleNumber(self, nums): 3 | return reduce(lambda x, y: x ^ y, nums) 4 | 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00202-Happy Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isHappy(self, n): 3 | s = set() 4 | while n != 1: 5 | if n in s: 6 | return False 7 | s.add(n) 8 | n = sum(map(lambda x: int(x) ** 2, str(n))) 9 | return True 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00242-Valid Anagram.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isAnagram(self, s, t): 3 | return sorted(s) == sorted(t) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00268-Missing Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def missingNumber(self, nums): 3 | n = len(nums) 4 | return sum(range(0, n + 1)) - sum(nums) 5 | 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00276-Paint Fence.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def numWays(self, n, k): 3 | if n == 0: 4 | return 0 5 | a, b = k, 0 6 | for i in xrange(1, n): 7 | a, b = a * (k - 1) + b * (k - 1), a 8 | return a + b 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00326-Power of Three.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isPowerOfThree(self, n): 3 | return n > 0 and (3 ** 233) % n == 0 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00338-Counting Bits.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countBits(self, num): 3 | res = [0 for i in xrange(num + 1)] 4 | for i in xrange(1, num + 1): 5 | res[i] = (i % 2) + res[i >> 1] 6 | return res 7 | 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00347-Top K Frequent Elements.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def topKFrequent(self, nums, k): 3 | d = {} 4 | for num in nums: 5 | d[num] = d.get(num, 0) + 1 6 | return map(lambda x: x[0], 7 | sorted(d.items(), key=lambda y: y[1], reverse=True)[:k]) 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00349-Intersection of Two Arrays.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def intersection(self, nums1, nums2): 3 | return list(set(nums1) & set(nums2)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00383-Ransom Note.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def canConstruct(self, ransomNote, magazine): 5 | c = Counter(magazine) 6 | c.subtract(ransomNote) 7 | return all(map(lambda (key, value): value >= 0, c.items())) 8 | 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00389-Find the Difference.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def findTheDifference(self, s, t): 5 | d = Counter(t) 6 | for item in s: 7 | d[item] -= 1 8 | return ''.join(map(lambda (k, v): k * v if v else '', d.items())) 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00392-Is Subsequence.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isSubsequence(self, s, t): 3 | s = list(s) 4 | t = list(t) 5 | while s and t: 6 | if s[-1] == t[-1]: 7 | s.pop() 8 | t.pop() 9 | return s == [] 10 | 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00398-Random Pick Index.py: -------------------------------------------------------------------------------- 1 | import random 2 | class Solution(object): 3 | def __init__(self, nums): 4 | self.nums = nums 5 | 6 | def pick(self, target): 7 | return random.choice([i for (i, num) in enumerate(self.nums) if num == target]) 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00409-Longest Palindrome.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def longestPalindrome(self, s): 5 | c = Counter(s) 6 | ans = 0 7 | for (k, v) in c.items(): 8 | ans += (v / 2) * 2 9 | return min(ans + 1, len(s)) 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00412-Fizz Buzz.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def fizzBuzz(self, n): 3 | return [('Fizz' if i % 3 == 0 else '') 4 | + ('Buzz' if i % 5 == 0 else '') 5 | + (str(i) if i % 3 != 0 and i % 5 != 0 else '') 6 | for i in xrange(1, n + 1)] 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00434-Number of Segments in a String.py: -------------------------------------------------------------------------------- 1 | import re 2 | class Solution(object): 3 | def countSegments(self, s): 4 | return len(re.findall('(\S+)', s)) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00453-Minimum Moves to Equal Array Elements.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minMoves(self, nums): 3 | m = min(nums) 4 | return sum(nums) - len(nums) * m 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00461-Hamming Distance.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def hammingDistance(self, x, y): 3 | z = x ^ y 4 | return '{:b}'.format(z).count('1') 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00500-Keyboard Row.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | class Solution(object): 4 | def findWords(self, words): 5 | return filter(lambda x: re.search('^([qwertyuiop]+|[asdfghjkl]+|[zxcvbnm]+)$', x.lower()), words) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00521-Longest Uncommon Subsequence I.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findLUSlength(self, a, b): 3 | if len(a) != len(b): 4 | return max(len(a), len(b)) 5 | elif a != b: 6 | return len(a) 7 | else: 8 | return -1 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00541-Reverse String II.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def reverseStr(self, s, k): 3 | n = len(s) 4 | s = list(s) 5 | for i in xrange(0, n, 2 * k): 6 | s[i: i + k] = s[i: i + k][::-1] 7 | return ''.join(s) 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00551-Student Attendance Record I.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def checkRecord(self, s): 3 | return s.count('A') <= 1 and s.count('LLL') == 0 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00557-Reverse Words in a String III.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def reverseWords(self, s): 3 | return ' '.join(map(lambda x: x[::-1], s.split())) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00561-Array Partition I.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def arrayPairSum(self, nums): 3 | return sum(sorted(nums)[::2]) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00575-Distribute Candies.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def distributeCandies(self, candies): 3 | s = set(candies) 4 | return min(len(candies) / 2, len(s)) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00598-Range Addition II.py: -------------------------------------------------------------------------------- 1 | INF = 0x3f3f3f3f 2 | 3 | class Solution(object): 4 | def maxCount(self, n, m, ops): 5 | minx, miny = m, n 6 | for (y, x) in ops: 7 | minx = min(minx, x) 8 | miny = min(miny, y) 9 | return minx * miny 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00660-Remove 9.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def newInteger(self, n): 3 | u = 9 ** 10 4 | res = '' 5 | while u: 6 | res += str(n / u) 7 | n %= u 8 | u /= 9 9 | return int(res) 10 | 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00693-Binary Number with Alternating Bits.py: -------------------------------------------------------------------------------- 1 | def lowbit(x): 2 | return x & (-x) 3 | 4 | class Solution(object): 5 | def hasAlternatingBits(self, n): 6 | a = n ^ (n >> 1) 7 | b = a ^ (a >> 1) 8 | c = b - lowbit(b) 9 | return c == 0 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00709-To Lower Case.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def toLowerCase(self, str): 3 | return str.lower() 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00724-Find Pivot Index.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def pivotIndex(self, nums): 3 | s = sum(nums) 4 | l = 0 5 | for i, num in enumerate(nums): 6 | if l == s - num: 7 | return i 8 | l += num 9 | s -= num 10 | return -1 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00744-Find Smallest Letter Greater Than Target.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def nextGreatestLetter(self, letters, target): 3 | return min(filter(lambda x: x > target, letters) or letters) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00747-Largest Number At Least Twice of Others.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def dominantIndex(self, nums): 3 | maxi = max(nums) 4 | remains = filter(lambda x: x < maxi, nums) 5 | return nums.index(maxi) if all([x * 2 <= maxi for x in remains]) else -1 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00771-Jewels and Stones.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def numJewelsInStones(self, J, S): 3 | J = set(J) 4 | return sum([1 if s in J else 0 for s in S]) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00791-Custom Sort String.py: -------------------------------------------------------------------------------- 1 | INF = 10 ** 10 2 | 3 | class Solution(object): 4 | def customSortString(self, S, T): 5 | d = dict(map(lambda (idx, value): (value, idx), enumerate(S))) 6 | return ''.join(sorted(T, key=lambda c: d.get(c, INF))) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00796-Rotate String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def rotateString(self, A, B): 3 | return B in A + A 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00810-Chalkboard XOR Game.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def xorGame(self, nums): 3 | if reduce(lambda x, y: x ^ y, nums) == 0: 4 | return True 5 | return len(nums) % 2 == 0 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00869-Reordered Power of 2.py: -------------------------------------------------------------------------------- 1 | def sortedstr(s): 2 | return ''.join(sorted(str(s))) 3 | 4 | s = set() 5 | for i in xrange(64): 6 | s.add(sortedstr(1 << i)) 7 | 8 | class Solution(object): 9 | def reorderedPowerOf2(self, N): 10 | return sortedstr(N) in s 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00877-Stone Game.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def stoneGame(self, piles): 3 | return True 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00893-Groups of Special-Equivalent Strings.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def numSpecialEquivGroups(self, A): 3 | for i in xrange(len(A)): 4 | A[i] = ''.join(sorted(A[i][::2]) + sorted(A[i][1::2])) 5 | return len(set(A)) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00905-Sort Array By Parity.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sortArrayByParity(self, A): 3 | return filter(lambda x: x % 2 == 0, A) + filter(lambda x: x % 2 == 1, A) 4 | 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00908-Smallest Range I.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def smallestRangeI(self, A, K): 3 | A.sort() 4 | a, b = A[0], A[-1] 5 | return max(0, b - a - 2 * K) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00917-Reverse Only Letters.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def reverseOnlyLetters(self, S): 3 | S = list(S) 4 | T = filter(lambda c: c.isalpha(), S)[::-1] 5 | for i, c in enumerate(S): 6 | if c.isalpha(): 7 | S[i] = T.pop(0) 8 | return ''.join(S) 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00973-K Closest Points to Origin.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | class Solution(object): 4 | def kClosest(self, points, K): 5 | return sorted(points, key=lambda (x, y): x * x + y * y)[:K] 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00977-Squares of a Sorted Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sortedSquares(self, A): 3 | return sorted(map(lambda x: x * x, A)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/0000/00989-Add to Array-Form of Integer.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def addToArrayForm(self, A, K): 3 | return map( 4 | int, 5 | str( 6 | int(''.join(map(str, A))) + K 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01003-Check If Word Is Valid After Substitutions.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isValid(self, S): 3 | st = [] 4 | for c in S: 5 | st.append(c) 6 | if st[-3:] == list('abc'): 7 | st = st[:-3] 8 | return len(st) == 0 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01018-Binary Prefix Divisible By 5.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def prefixesDivBy5(self, A): 3 | res = [] 4 | cur = 0 5 | for a in A: 6 | cur = cur * 2 + a 7 | res.append(cur % 5 == 0) 8 | return res 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01029-Two City Scheduling.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def twoCitySchedCost(self, costs): 3 | n = len(costs) 4 | costs.sort(key=lambda (x, y): x - y) 5 | return sum(map(lambda x: x[0], costs[:n / 2]) + map(lambda x: x[1], costs[n / 2:])) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01047-Remove All Adjacent Duplicates In String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def removeDuplicates(self, S): 3 | T = [] 4 | for c in S: 5 | if T and T[-1] == c: 6 | T.pop() 7 | continue 8 | T.append(c) 9 | return ''.join(T) 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01108-Defanging an IP Address.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def defangIPaddr(self, address): 3 | return address.replace('.', '[.]') 4 | 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01121-Divide Array Into Increasing Sequences.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def canDivideIntoSubsequences(self, nums, K): 5 | c = Counter(nums) 6 | l = max(c.values()) 7 | r = len(nums) 8 | 9 | return r / l >= K 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01122-Relative Sort Array.py: -------------------------------------------------------------------------------- 1 | INF = 10 ** 10 2 | 3 | class Solution(object): 4 | def relativeSortArray(self, arr1, arr2): 5 | d = dict(map(lambda (idx, value): (value, idx), enumerate(arr2))) 6 | return sorted(arr1, key=lambda x: d.get(x, INF + x)) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01137-N-th Tribonacci Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def tribonacci(self, n): 3 | T = [0, 1, 1] 4 | for i in xrange(3, n + 1): 5 | u = T[i - 1] + T[i - 2] + T[i - 3] 6 | T.append(u) 7 | return T[n] 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01154-Day of the Year.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | class Solution(object): 4 | def dayOfYear(self, date): 5 | y, m, d = map(int, date.split('-')) 6 | return (datetime.datetime(y, m, d) - datetime.datetime(y, 1, 1)).days + 1 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01207-Unique Number of Occurrences.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def uniqueOccurrences(self, arr): 5 | c = Counter(Counter(arr).values()) 6 | return len(c) == sum(c.values()) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01250-Check If It Is a Good Array.py: -------------------------------------------------------------------------------- 1 | def gcd(a, b): 2 | if a % b == 0: 3 | return b 4 | return gcd(b, a % b) 5 | 6 | class Solution(object): 7 | def isGoodArray(self, nums): 8 | return reduce(lambda x, y: gcd(x, y), nums) == 1 9 | 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01281-Subtract the Product and Sum of Digits of an Integer.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def subtractProductAndSum(self, n): 3 | nums = map(int, str(n)) 4 | p = reduce(lambda x, y: x * y, nums, 1) 5 | s = sum(nums) 6 | return p - s 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01295-Find Numbers with Even Number of Digits.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findNumbers(self, nums): 3 | return len(filter(lambda s: len(str(s)) % 2 == 0, nums)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01304-Find N Unique Integers Sum up to Zero.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sumZero(self, n): 3 | if n % 2 == 0: 4 | return range(1, n / 2 + 1) + range(-n / 2, 0) 5 | else: 6 | return range(n / 2 + 1) + range(-n / 2 + 1, 0) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01313-Decompress Run-Length Encoded List.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def decompressRLElist(self, nums): 3 | res = [] 4 | n = len(nums) 5 | for i in xrange(0, n, 2): 6 | a, b = nums[i], nums[i + 1] 7 | res += [b] * a 8 | return res 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01323-Maximum 69 Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maximum69Number (self, num): 3 | num = str(num) 4 | num = num.replace('6', '9', 1) 5 | return int(num) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01331-Rank Transform of an Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def arrayRankTransform(self, arr): 3 | brr = sorted(set(arr)) 4 | d = {} 5 | for i, num in enumerate(brr): 6 | d[num] = i + 1 7 | return map(lambda num: d[num], arr) 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01332-Remove Palindromic Subsequences.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def removePalindromeSub(self, s): 3 | if not s: 4 | return 0 5 | if s == s[::-1]: 6 | return 1 7 | return 2 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01408-String Matching in an Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def stringMatching(self, words): 3 | res = [] 4 | for word in words: 5 | if any([word != other and word in other for other in words]): 6 | res.append(word) 7 | return res 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01426-Counting Elements.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countElements(self, arr): 3 | st = set(arr) 4 | return len([x for x in arr if x + 1 in st]) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01431-Kids With the Greatest Number of Candies.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def kidsWithCandies(self, candies, extra): 3 | maxi = max(candies) 4 | return [c + extra >= maxi for c in candies] 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01455-Check If a Word Occurs As a Prefix of Any Word in a Sentence.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isPrefixOfWord(self, sentence, searchWord): 3 | for i, word in enumerate(sentence.split()): 4 | if word.startswith(searchWord): 5 | return i + 1 6 | return -1 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01460-Make Two Arrays Equal by Reversing Sub-arrays.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def canBeEqual(self, target, arr): 3 | return sorted(target) == sorted(arr) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01464-Maximum Product of Two Elements in an Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maxProduct(self, nums): 3 | nums.sort() 4 | a, b = nums[-1], nums[-2] 5 | return (a - 1) * (b - 1) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01470-Shuffle the Array.py: -------------------------------------------------------------------------------- 1 | from itertools import chain 2 | 3 | class Solution(object): 4 | def shuffle(self, nums, n): 5 | return chain.from_iterable(zip(nums[:n], nums[n:])) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01471-The k Strongest Values in an Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def getStrongest(self, arr, k): 3 | n = len(arr) 4 | arr.sort() 5 | mid = arr[(n - 1) / 2] 6 | return sorted(arr, key=lambda x: (abs(x - mid), x), reverse=True)[:k] 7 | 8 | 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01480-Running Sum of 1d Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def runningSum(self, nums): 3 | n = len(nums) 4 | for i in xrange(1, n): 5 | nums[i] += nums[i - 1] 6 | return nums 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01486-XOR Operation in an Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def xorOperation(self, n, start): 3 | res = 0 4 | for i in xrange(n): 5 | res ^= start + i * 2 6 | return res 7 | 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01491-Average Salary Excluding the Minimum and Maximum Salary.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def average(self, salary): 3 | tot = sum(salary) - min(salary) - max(salary) 4 | return 1.0 * tot / (len(salary) - 2) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01492-The kth Factor of n.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def kthFactor(self, n, k): 3 | cnt = 0 4 | for i in xrange(1, n + 1): 5 | if n % i == 0: 6 | cnt += 1 7 | if cnt == k: 8 | return i 9 | return -1 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01503-Last Moment Before All Ants Fall Out of a Plank.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def getLastMoment(self, n, left, right): 3 | maxi = 0 4 | for ant in right: 5 | maxi = max(maxi, n - ant) 6 | for ant in left: 7 | maxi = max(maxi, ant) 8 | return maxi 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01512-Number of Good Pairs.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def numIdenticalPairs(self, nums): 5 | c = Counter(nums) 6 | res = 0 7 | for k, v in c.items(): 8 | res += v * (v - 1) / 2 9 | return res 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01523-Count Odd Numbers in an Interval Range.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countOdds(self, low, high): 3 | if low % 2 == 0: 4 | low += 1 5 | return max(0, (high - low) / 2 + 1) 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01528-Shuffle String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def restoreString(self, s, indices): 3 | return ''.join(map(lambda (idx, c): c, sorted(zip(indices, s)))) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01561-Maximum Number of Coins You Can Get.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maxCoins(self, piles): 3 | n = len(piles) 4 | return sum(sorted(piles)[n / 3::][::-1][1::2]) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01619-Mean of Array After Removing Some Elements.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def trimMean(self, arr): 3 | arr.sort() 4 | n = len(arr) 5 | m = int(n * 0.05) 6 | arr = arr[m:-m] 7 | return 1.0 * sum(arr) / len(arr) 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01641-Count Sorted Vowel Strings.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countVowelStrings(self, n): 3 | dp = [1, 1, 1, 1, 1] 4 | for i in xrange(n - 1): 5 | dp = [sum(dp[i:]) for i in xrange(5)] 6 | return sum(dp) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01662-Check If Two String Arrays are Equivalent.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def arrayStringsAreEqual(self, word1, word2): 3 | return ''.join(word1) == ''.join(word2) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01672-Richest Customer Wealth.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maximumWealth(self, accounts): 3 | return max(map(sum, accounts)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01678-Goal Parser Interpretation.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def interpret(self, command): 3 | return command.replace('(al)', 'al') \ 4 | .replace('()', 'o') 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01684-Count the Number of Consistent Strings.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countConsistentStrings(self, allowed, words): 3 | allowed = set(allowed) 4 | return len(filter(lambda word: set(word).issubset(allowed), words)) 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01688-Count of Matches in Tournament.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def numberOfMatches(self, n): 3 | return 0 if n == 1 else self.numberOfMatches((n + 1) / 2) + n / 2 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01689-Partitioning Into Minimum Number Of Deci-Binary Numbers.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minPartitions(self, n): 3 | return max(map(int, str(n))) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01720-Decode XORed Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def decode(self, encoded, first): 3 | res = [first] 4 | for num in encoded: 5 | res.append(res[-1] ^ num) 6 | return res 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01780-Check if Number is a Sum of Powers of Three.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def checkPowersOfThree(self, n): 3 | while n: 4 | if n % 3 == 2: 5 | return False 6 | n /= 3 7 | return True 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01784-Check if Binary String Has at Most One Segment of Ones.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def checkOnesSegment(self, s): 3 | return len(filter(lambda x: x, s.split("0"))) <= 1 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01785-Minimum Elements to Add to Form a Given Sum.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minElements(self, nums, limit, goal): 3 | delta = abs(goal - sum(nums)) 4 | return (delta + limit - 1) / limit 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01832-Check if the Sentence Is Pangram.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def checkIfPangram(self, sentence): 3 | return len(set(sentence)) == 26 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01869-Longer Contiguous Segments of Ones than Zeros.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def checkZeroOnes(self, s): 3 | a = max(map(len, s.split('0'))) 4 | b = max(map(len, s.split('1'))) 5 | return a > b 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01884-Egg Drop With 2 Eggs and N Floors.py: -------------------------------------------------------------------------------- 1 | INF = 10 ** 10 2 | 3 | class Solution(object): 4 | def twoEggDrop(self, n): 5 | tot = 0 6 | for i in xrange(1, INF): 7 | tot += i 8 | if tot >= n: 9 | return i 10 | 11 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01903-Largest Odd Number in String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def largestOddNumber(self, num): 3 | num = list(num) 4 | while num and int(num[-1]) % 2 == 0: 5 | num.pop() 6 | return ''.join(num) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01913-Maximum Product Difference Between Two Pairs.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maxProductDifference(self, nums): 3 | nums.sort(reverse=True) 4 | return nums[0] * nums[1] - nums[-1] * nums[-2] 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01920-Build Array from Permutation.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def buildArray(self, nums): 3 | n = len(nums) 4 | res = [-1 for i in xrange(n)] 5 | 6 | for i, num in enumerate(nums): 7 | res[i] = nums[nums[i]] 8 | return res 9 | 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01922-Count Good Numbers.py: -------------------------------------------------------------------------------- 1 | MOD = (10 ** 9) + 7 2 | 3 | class Solution(object): 4 | def countGoodNumbers(self, n): 5 | odd = n / 2 6 | even = n - odd 7 | return pow(5, even, MOD) * pow(4, odd, MOD) % MOD 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01929-Concatenation of Array.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def getConcatenation(self, nums): 3 | return nums + nums 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01941-Check if All Characters Have Equal Number of Occurrences.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def areOccurrencesEqual(self, s): 5 | c = Counter(s) 6 | return len(set(c.values())) == 1 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01967-Number of Strings That Appear as Substrings in Word.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def numOfStrings(self, patterns, word): 3 | return len(filter(lambda p: p in word, patterns)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01969-Minimum Non-Zero Product of the Array Elements.py: -------------------------------------------------------------------------------- 1 | MOD = (10 ** 9) + 7 2 | 3 | class Solution(object): 4 | def minNonZeroProduct(self, p): 5 | res = (1 << p) - 1 6 | res *= pow((1 << p) - 2, ((1 << p) - 1) / 2, MOD) 7 | return res % MOD 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/1000/01979-Find Greatest Common Divisor of Array.py: -------------------------------------------------------------------------------- 1 | def gcd(a, b): 2 | while a % b: 3 | a, b = b, a % b 4 | return b 5 | 6 | class Solution(object): 7 | def findGCD(self, nums): 8 | maxi = max(nums) 9 | mini = min(nums) 10 | 11 | return gcd(maxi, mini) 12 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02011-Final Value of Variable After Performing Operations.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def finalValueAfterOperations(self, operations): 3 | return eval(''.join(map(lambda x: x.replace('X', '') 4 | .replace('++', '+1').replace('--', '-1'), operations))) -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02154-Keep Multiplying Found Values by Two.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findFinalValue(self, nums, original): 3 | s = set(nums) 4 | while original in s: 5 | original *= 2 6 | return original 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02177-Find Three Consecutive Integers That Sum to a Given Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sumOfThree(self, num): 3 | base = (num - 3) / 3 4 | res = [base, base + 1, base + 2] 5 | if sum(res) == num: 6 | return res 7 | else: 8 | return [] 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02220-Minimum Bit Flips to Convert Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minBitFlips(self, start, goal): 3 | return '{:b}'.format(start ^ goal).count('1') 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02248-Intersection of Multiple Arrays.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def intersection(self, nums): 3 | return sorted(reduce(lambda x, y: x & y, map(set, nums))) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02255-Count Prefixes of a Given String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countPrefixes(self, words, s): 3 | cnt = 0 4 | for word in words: 5 | if s.startswith(word): 6 | cnt += 1 7 | return cnt 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02278-Percentage of Letter in String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def percentageLetter(self, s, letter): 3 | n = len(s) 4 | c = s.count(letter) 5 | 6 | return 100 * c / n 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02351-First Letter to Appear Twice.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def repeatedCharacter(self, s): 3 | st = set() 4 | for c in s: 5 | if c in st: 6 | return c 7 | st.add(c) 8 | return '$' 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02363-Merge Similar Items.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | class Solution(object): 4 | def mergeSimilarItems(self, items1, items2): 5 | d = defaultdict(int) 6 | for (v, w) in items1 + items2: 7 | d[v] += w 8 | return sorted(map(list, d.items())) 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02367-Number of Arithmetic Triplets.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def arithmeticTriplets(self, nums, diff): 3 | st = set(nums) 4 | cnt = 0 5 | for num in nums: 6 | if num + diff in st and num + 2 * diff in st: 7 | cnt += 1 8 | return cnt 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02418-Sort the People.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sortPeople(self, names, heights): 3 | return map(lambda x: x[1], sorted(zip(heights, names), reverse=True)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02540-Minimum Common Value.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def getCommon(self, nums1, nums2): 3 | common = set(nums1) & set(nums2) 4 | if not common: 5 | return -1 6 | return min(common) 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02544-Alternating Digit Sum.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def alternateDigitSum(self, n): 3 | ns = map(int, str(n)) 4 | ans = 0 5 | for i, num in enumerate(ns): 6 | ans += num * ((-1) ** i) 7 | return ans 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02545-Sort the Students by Their Kth Score.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sortTheStudents(self, score, k): 3 | return sorted(score, key=lambda x: x[k], reverse=True) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02546-Apply Bitwise Operations to Make Strings Equal.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def makeStringsEqual(self, s, target): 3 | if '1' in s and '1' in target: 4 | return True 5 | return s == target 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02558-Take Gifts From the Richest Pile.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | class Solution(object): 4 | def pickGifts(self, gifts, k): 5 | for i in xrange(k): 6 | gifts.sort() 7 | gifts[-1] = int(math.sqrt(gifts[-1])) 8 | return sum(gifts) 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02651-Calculate Delayed Arrival Time.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findDelayedArrivalTime(self, arrivalTime, delayedTime): 3 | return (arrivalTime + delayedTime) % 24 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02652-Sum Multiples.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sumOfMultiples(self, n): 3 | tot = 0 4 | for i in xrange(1, n + 1): 5 | if i % 3 == 0 or i % 5 == 0 or i % 7 == 0: 6 | tot += i 7 | return tot 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02656-Maximum Sum With Exactly K Elements.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maximizeSum(self, nums, k): 3 | return max(nums) * k + (k - 1) * k / 2 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02733-Neither Minimum nor Maximum.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findNonMinOrMax(self, nums): 3 | mini = min(nums) 4 | maxi = max(nums) 5 | 6 | res = filter(lambda x: x not in [mini, maxi], nums) 7 | return res[0] if res else -1 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02810-Faulty Keyboard.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def finalString(self, s): 3 | st = [] 4 | for c in s: 5 | if c == 'i': 6 | st = st[::-1] 7 | else: 8 | st.append(c) 9 | return ''.join(st) 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02894-Divisible and Non-divisible Sums Difference.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def differenceOfSums(self, n, m): 3 | num1 = sum(filter(lambda x: x % m != 0, range(1, n + 1))) 4 | num2 = sum(filter(lambda x: x % m == 0, range(1, n + 1))) 5 | return num1 - num2 6 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02942-Find Words Containing Character.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findWordsContaining(self, words, x): 3 | res = [] 4 | for i, word in enumerate(words): 5 | if x in word: 6 | res.append(i) 7 | return res 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02974-Minimum Number Game.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def numberGame(self, nums): 3 | n = len(nums) 4 | nums.sort() 5 | for i in xrange(0, n, 2): 6 | nums[i], nums[i + 1] = nums[i + 1], nums[i] 7 | return nums 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/02980-Check if Bitwise OR Has Trailing Zeros.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def hasTrailingZeros(self, nums): 3 | evens = filter(lambda x: x % 2 == 0, nums) 4 | return len(evens) >= 2 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/2000/03019-Number of Changing Keys.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countKeyChanges(self, s): 3 | pre = None 4 | cnt = 0 5 | for c in s.lower(): 6 | if c != pre: 7 | cnt += 1 if pre else 0 8 | pre = c 9 | return cnt 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03021-Alice and Bob Playing Flower Game.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def flowerGame(self, n, m): 3 | return ((n + 1) / 2) * (m / 2) + (n / 2) * ((m + 1) / 2) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03046-Split the Array.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | class Solution(object): 4 | def isPossibleToSplit(self, nums): 5 | c = Counter(nums) 6 | for (key, count) in c.items(): 7 | if count > 2: 8 | return False 9 | return True 10 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03065-Minimum Operations to Exceed Threshold Value I.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minOperations(self, nums, k): 3 | return len(filter(lambda x: x < k, nums)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03075-Maximize Happiness of Selected Children.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maximumHappinessSum(self, hs, k): 3 | hs.sort(reverse=True) 4 | tot = 0 5 | for i in xrange(k): 6 | tot += max(0, hs[i] - i) 7 | return tot 8 | 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03079-Find the Sum of Encrypted Integers.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sumOfEncryptedInt(self, nums): 3 | tot = 0 4 | for num in nums: 5 | maxi = max(map(int, str(num))) 6 | tot += maxi * int('1' * len(str(num))) 7 | return tot 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03083-Existence of a Substring in a String and Its Reverse.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isSubstringPresent(self, s): 3 | for i in xrange(len(s) - 1): 4 | sub = s[i: i + 2] 5 | if sub in s and sub in s[::-1]: 6 | return True 7 | return False 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03084-Count Substrings Starting and Ending with Given Character.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def countSubstrings(self, s, c): 3 | m = s.count(c) 4 | return m * (m - 1) / 2 + m 5 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03099-Harshad Number.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def sumOfTheDigitsOfHarshadNumber(self, x): 3 | y = sum(map(int, str(x))) 4 | if x % y == 0: 5 | return y 6 | else: 7 | return -1 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03146-Permutation Difference between Two Strings.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def findPermutationDifference(self, s, t): 3 | t = dict(map(lambda (x, y): (y, x), enumerate(t))) 4 | ans = 0 5 | for i, c in enumerate(s): 6 | ans += abs(i - t[c]) 7 | return ans 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03151-Special Array I.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def isArraySpecial(self, nums): 3 | n = len(nums) 4 | for i in xrange(0, n - 1): 5 | if (nums[i] % 2) ^ (nums[i + 1] % 2) == 0: 6 | return False 7 | return True 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03300-Minimum Element After Replacement With Digit Sum.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minElement(self, nums): 3 | return min(map(lambda x: sum(map(int, str(x))), nums)) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03370-Smallest Number With All Set Bits.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def smallestNumber(self, n): 3 | for i in xrange(123456789): 4 | if (1 << i) - 1 >= n: 5 | return (1 << i) - 1 6 | return -1 7 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03487-Maximum Unique Subarray Sum After Deletion.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maxSum(self, nums): 3 | return max(nums) if max(nums) <= 0 else sum(set(filter(lambda x : x >= 0, nums))) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03492-Maximum Containers on a Ship.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def maxContainers(self, n, w, maxWeight): 3 | return min(n * n, maxWeight / w) 4 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03498-Reverse Degree of a String.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def reverseDegree(self, s): 3 | tot = 0 4 | for i, c in enumerate(s): 5 | c = 26 - (ord(c) - ord('a')) 6 | tot += c * (i + 1) 7 | return tot 8 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/python/3000/03502-Minimum Cost to Reach Every Position.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def minCosts(self, cost): 3 | maxi = 10 ** 100 4 | res = [] 5 | for c in cost: 6 | maxi = min(maxi, c) 7 | res.append(maxi) 8 | return res 9 | -------------------------------------------------------------------------------- /Leetcode/Algorithm/swift/00274-H-Index.swift: -------------------------------------------------------------------------------- 1 | class Solution { 2 | func hIndex(citations: [Int]) -> Int { 3 | var ans = 0 4 | for (index, element) in citations.sort().reverse().enumerate() { 5 | if element >= index + 1 { 6 | ans = index + 1 7 | } 8 | } 9 | return ans 10 | } 11 | } -------------------------------------------------------------------------------- /Leetcode/Database/Combine Two Tables.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | Person.FirstName, Person.LastName, Address.City, Address.State 3 | FROM 4 | Person 5 | LEFT JOIN Address ON Person.PersonID = Address.PersonID; -------------------------------------------------------------------------------- /Leetcode/Database/Duplicate Emails.sql: -------------------------------------------------------------------------------- 1 | SELECT Email from Person GROUP BY Email HAVING Count(*) > 1; 2 | -------------------------------------------------------------------------------- /Leetcode/Database/Not Boring Movies.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM cinema WHERE id % 2 = 1 AND description != "boring" ORDER BY rating DESC; -------------------------------------------------------------------------------- /Leetcode/Database/Nth Highest Salary.sql: -------------------------------------------------------------------------------- 1 | CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT 2 | BEGIN 3 | DECLARE M INT; 4 | SET M=N-1; 5 | RETURN ( 6 | SELECT DISTINCT Salary FROM Employee 7 | ORDER BY Salary DESC 8 | LIMIT M, 1 9 | ); 10 | END 11 | -------------------------------------------------------------------------------- /Leetcode/Database/Rising Temperature.sql: -------------------------------------------------------------------------------- 1 | # Write your MySQL query statement below 2 | SELECT cur_w.Id 3 | FROM Weather as cur_w 4 | JOIN Weather as pre_w 5 | ON 6 | TO_DAYS(cur_w.Date) = TO_DAYS(pre_w.Date) + 1 7 | AND 8 | cur_w.Temperature > pre_w.Temperature; 9 | -------------------------------------------------------------------------------- /Leetcode/Database/Second Highest Salary.sql: -------------------------------------------------------------------------------- 1 | SELECT MAX(Salary) as SecondHighestSalary FROM Employee 2 | WHERE Salary < ( 3 | SELECT MAX(Salary) FROM Employee 4 | ); 5 | -------------------------------------------------------------------------------- /Leetcode/Shell/00192-Word Frequency.bash: -------------------------------------------------------------------------------- 1 | cat words.txt | tr -s "[:blank:]" "\n" | sort | uniq -c | sort -r | awk '{ print $2, $1 }' 2 | -------------------------------------------------------------------------------- /Leetcode/Shell/00195-Tenth Line.bash: -------------------------------------------------------------------------------- 1 | # Read from the file file.txt and output the tenth line to stdout. 2 | head -n 10 file.txt | tail -n +10 3 | -------------------------------------------------------------------------------- /LintCode/cpp/Coins in a Line.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | /** 4 | * @param n: an integer 5 | * @return: a boolean which equals to true if the first player will win 6 | */ 7 | bool firstWillWin(int n) { 8 | return n % 3; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /LintCode/cpp/O(1) Check Power of 2.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | /* 4 | * @param n: An integer 5 | * @return: True or false 6 | */ 7 | bool checkPowerOf2(int n) { 8 | return n > 0 && (n & (n - 1)) == 0; 9 | } 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /LintCode/cpp/Singleton.cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | /** 4 | * @return: The same instance of this class every time 5 | */ 6 | static Solution* getInstance() { 7 | static Solution s; 8 | return &s; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /LintCode/python/2450 · Start the thread to print hello world.py: -------------------------------------------------------------------------------- 1 | # you can import any package that you need here 2 | # -- write your code here -- 3 | 4 | import sys 5 | from threading import Thread 6 | 7 | def run_print_in_thread(print_hello_world): 8 | t = Thread(target=print_hello_world) 9 | t.start() 10 | t.join() 11 | -------------------------------------------------------------------------------- /LintCode/python/82 · Single Number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | """ 3 | @param A : an integer array 4 | @return : a integer 5 | """ 6 | def singleNumber(self, A): 7 | return reduce(lambda x, y: x ^ y, A, 0) 8 | -------------------------------------------------------------------------------- /LintCode/python/Count and Say.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/LintCode/python/Count and Say.py -------------------------------------------------------------------------------- /LintCode/python/Factorial.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | """ 3 | @param n: an integer 4 | @return: the factorial of n 5 | """ 6 | def factorial(self, n): 7 | return str(reduce(lambda x, y: x * y, range(1, n + 1), 1)) 8 | -------------------------------------------------------------------------------- /LintCode/python/Find Minimum in Rotated Sorted Array II.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @param num: a rotated sorted array 3 | # @return: the minimum number in the array 4 | def findMin(self, num): 5 | return min(num) 6 | -------------------------------------------------------------------------------- /LintCode/python/Length of Last Word.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @param {string} s A string 3 | # @return {int} the length of last word 4 | def lengthOfLastWord(self, s): 5 | try: 6 | return len(s.split()[-1]) 7 | except: 8 | return 0 9 | -------------------------------------------------------------------------------- /LintCode/python/Palindrome Number II.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | """ 3 | @param n: non-negative integer n. 4 | @return: return whether a binary representation of a non-negative integer n is a palindrome. 5 | """ 6 | def isPalindrome(self, n): 7 | s = '{:b}'.format(n) 8 | return s == s[::-1] 9 | -------------------------------------------------------------------------------- /LintCode/python/Reorder array to construct the minimum number.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | """ 3 | @param: nums: n non-negative integer array 4 | @return: A string 5 | """ 6 | def minNumber(self, nums): 7 | return str(int(''.join(map(str, sorted(nums, cmp=lambda x, y: cmp(int(str(x) + str(y)), int(str(y) + str(x)))))))) 8 | -------------------------------------------------------------------------------- /LintCode/python/Reverse Words in a String.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @param s : A string 3 | # @return : A string 4 | def reverseWords(self, s): 5 | return ' '.join(s.split()[::-1]) 6 | -------------------------------------------------------------------------------- /LintCode/python/Two Strings Are Anagrams.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | """ 3 | @param s: The first string 4 | @param b: The second string 5 | @return true or false 6 | """ 7 | def anagram(self, s, t): 8 | return sorted(s) == sorted(t) 9 | -------------------------------------------------------------------------------- /LintCode/python/Unique Characters.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | # @param s: a string 3 | # @return: a boolean 4 | def isUnique(self, str): 5 | return len(set(str)) == len(str) 6 | -------------------------------------------------------------------------------- /LintCode/python/Valid Palindrome.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | class Solution: 4 | # @param {string} s A string 5 | # @return {boolean} Whether the string is a valid palindrome 6 | def isPalindrome(self, s): 7 | s = ''.join(re.findall("[a-zA-Z0-9]", s)).lower() 8 | return s == s[::-1] 9 | -------------------------------------------------------------------------------- /LintCode/python/Valid Perfect Square.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | class Solution: 4 | """ 5 | @param num: a positive integer 6 | @return: if num is a perfect square else False 7 | """ 8 | def isPerfectSquare(self, num): 9 | return int(math.sqrt(num)) ** 2 == num 10 | -------------------------------------------------------------------------------- /Luogu/B/B2002.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello,World!"); 3 | } 4 | -------------------------------------------------------------------------------- /Luogu/P/P1009.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | res = 0 3 | cur = 1 4 | for i in xrange(1, n + 1): 5 | cur *= i 6 | res += cur 7 | print res 8 | -------------------------------------------------------------------------------- /Luogu/P/P1591.py: -------------------------------------------------------------------------------- 1 | T = int(raw_input()) 2 | for case_ in xrange(T): 3 | (n, a) = map(int, raw_input().split()) 4 | s = str(reduce(lambda a, b: a * b, range(1, n + 1))) 5 | print s.count(str(a)) 6 | -------------------------------------------------------------------------------- /Luogu/P/P4136.py: -------------------------------------------------------------------------------- 1 | while True: 2 | n = int(input()) 3 | if n == 0: 4 | break 5 | print('Alice' if n % 2 == 0 else 'Bob') 6 | -------------------------------------------------------------------------------- /Luogu/P/P5015.py: -------------------------------------------------------------------------------- 1 | print(len(list(filter(lambda x: x.strip(), input())))) 2 | -------------------------------------------------------------------------------- /Luogu/P/P6153.py: -------------------------------------------------------------------------------- 1 | import sys 2 | input = sys.stdin.readline 3 | print = sys.stdout.write 4 | 5 | n, m = map(int, input().split()) 6 | 7 | for _ in range(m): 8 | _ = input() 9 | 10 | print(str(n - m) + '\n') 11 | -------------------------------------------------------------------------------- /Note/Basic Algorithms/Basic Algorithms.md: -------------------------------------------------------------------------------- 1 | ## Basic Algorithms 2 | 3 | * [[DFS]] 4 | * [[BFS]] 5 | * [[Sorting]] 6 | -------------------------------------------------------------------------------- /Note/Basic Algorithms/DFS.md: -------------------------------------------------------------------------------- 1 | # DFS -------------------------------------------------------------------------------- /Note/Data Structures/Data Structures.md: -------------------------------------------------------------------------------- 1 | ## Data Structures 2 | 3 | * Array 4 | * List 5 | * [[Tree]] -------------------------------------------------------------------------------- /Note/Graph Theory/Graph Theory.md: -------------------------------------------------------------------------------- 1 | ## Graph Theory 2 | 3 | ### Basic 4 | 5 | * [[Graph Traversal]] 6 | 7 | ### Tree 8 | 9 | * [[Tree Centroid]] 10 | * Tree Diameter 11 | 12 | ### Graph 13 | 14 | * [[Disjont Set]] 15 | * Shortest Path 16 | -------------------------------------------------------------------------------- /Note/Implementation.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/Note/Implementation.md -------------------------------------------------------------------------------- /Note/Misc.md: -------------------------------------------------------------------------------- 1 | ## Misc 2 | 3 | * Constructive 4 | * [[Randomized Algorithm]] 5 | * [[Implementation]] -------------------------------------------------------------------------------- /Note/Problem Solving/Problem Solving.md: -------------------------------------------------------------------------------- 1 | # Problem Solving 2 | 3 | * [[Greedy]] 4 | * [[Parity]] 5 | * [[Sliding Window]] -------------------------------------------------------------------------------- /Note/Problem Solving/Solutions/LC2747-Count Zero Request Servers.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/Note/Problem Solving/Solutions/LC2747-Count Zero Request Servers.md -------------------------------------------------------------------------------- /Nowcoder/剑指Offer/README.md: -------------------------------------------------------------------------------- 1 | ## 值得一做的题 2 | 3 | * 旋转数组的最小数字 4 | 寻找二分算法中的不变量 5 | * 跳台阶 & 变态跳台阶 & 矩形覆盖 6 | DP初步 7 | * 反转链表 8 | 链表经典题 9 | -------------------------------------------------------------------------------- /Nowcoder/剑指Offer/二进制中1的个数,cc: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int NumberOf1(int n) { 4 | int res = 0; 5 | for (int i = 0; i < 32; i++) { 6 | res += bool(n & (1 << i)); 7 | } 8 | return res; 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /Nowcoder/剑指Offer/斐波那契数列.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | class Solution: 3 | def Fibonacci(self, n): 4 | if n == 0: 5 | return 0 6 | elif n == 1: 7 | return 1 8 | a, b = 1, 1 9 | for i in xrange(2, n + 1): 10 | a, b = b, a + b 11 | return a 12 | -------------------------------------------------------------------------------- /Nowcoder/剑指Offer/替换空格.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | class Solution: 3 | # s 源字符串 4 | def replaceSpace(self, s): 5 | return s.replace(' ', '%20') 6 | -------------------------------------------------------------------------------- /Nowcoder/剑指Offer/跳台阶.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | class Solution: 3 | def jumpFloor(self, number): 4 | if number <= 1: 5 | return 1 6 | a, b = 1, 1 7 | for i in xrange(2, number + 1): 8 | a, b = b, a + b 9 | return b 10 | -------------------------------------------------------------------------------- /Nowcoder/牛客练习赛19/README.md: -------------------------------------------------------------------------------- 1 | https://www.nowcoder.com/acm/contest/111#description -------------------------------------------------------------------------------- /Nowcoder/牛客练习赛29/README.md: -------------------------------------------------------------------------------- 1 | https://www.nowcoder.com/acm/contest/211#question 2 | -------------------------------------------------------------------------------- /POJ/1/1000.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a,b; 6 | scanf("%d%d",&a,&b); 7 | printf("%d\n",a+b); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /POJ/1/1012.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int J[14]={2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881,13482720}; 4 | 5 | 6 | int main() 7 | { 8 | int n; 9 | scanf("%d",&n); 10 | while(n!=0) 11 | { 12 | printf("%d\n",J[n-1]); 13 | scanf("%d",&n); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /POJ/2/2109.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main() 7 | { 8 | double a,b; 9 | while(scanf("%lf%lf",&a,&b)!=EOF) 10 | { 11 | printf("%.0f\n",pow(b,1/a)); 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /POJ/3/3372.cc: -------------------------------------------------------------------------------- 1 | //Result:wizmann 3372 Accepted 376K 0MS G++ 126B 2 | #include 3 | 4 | int main() 5 | { 6 | int x; 7 | while(scanf("%d",&x)!=EOF) 8 | { 9 | puts(x&(x-1)?"NO":"YES"); 10 | } 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /POJ/3/3980.cc: -------------------------------------------------------------------------------- 1 | //Result:wizmann 3980 Accepted 164K 125MS C++ 125B 2 | #include 3 | 4 | int main() 5 | { 6 | int a,b; 7 | while(scanf("%d%d",&a,&b)!=EOF) 8 | { 9 | printf("%d\n",a%b); 10 | } 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Project Euler/0001.scala: -------------------------------------------------------------------------------- 1 | object PE_1 { 2 | def main(args: Array[String]) { 3 | println((0 until 1000).filter(x => x % 3 == 0 || x % 5 == 0).sum) 4 | } 5 | } -------------------------------------------------------------------------------- /Project Euler/0003.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | v = 600851475143 4 | 5 | up = int(math.sqrt(v)) + 1 6 | 7 | f = [] 8 | 9 | for i in xrange(2, up): 10 | if v % i == 0: 11 | f.append(i) 12 | while v % i == 0: 13 | v /= i 14 | 15 | print max(f) 16 | 17 | -------------------------------------------------------------------------------- /Project Euler/0004.py: -------------------------------------------------------------------------------- 1 | def is_palin(x): 2 | v = str(x) 3 | return v == v[::-1] 4 | 5 | 6 | ans = 0 7 | 8 | for i in xrange(100, 1000): 9 | for j in xrange(100, 1000): 10 | t = i * j 11 | if is_palin(t): 12 | ans = max(ans, t) 13 | 14 | print ans 15 | -------------------------------------------------------------------------------- /Project Euler/0005.py: -------------------------------------------------------------------------------- 1 | primes = [2, 3, 5, 7, 11, 13, 17, 19] 2 | 3 | ans = 1 4 | for item in primes: 5 | a = item 6 | while a <= 20: 7 | a *= item 8 | 9 | ans *= a / item 10 | 11 | print ans 12 | -------------------------------------------------------------------------------- /Project Euler/0006.py: -------------------------------------------------------------------------------- 1 | print sum(range(1, 101)) ** 2 - sum(map(lambda x: x ** 2, range(1, 101))) 2 | -------------------------------------------------------------------------------- /Project Euler/0009.py: -------------------------------------------------------------------------------- 1 | for i in xrange(1000): 2 | for j in xrange(1000 - i): 3 | k = 1000 - i - j 4 | if i and j and k and i * i + j * j == k * k: 5 | print i, j, k 6 | print i * j * k 7 | -------------------------------------------------------------------------------- /Project Euler/0015.py: -------------------------------------------------------------------------------- 1 | def C(a, b): 2 | c = 1 3 | for i in xrange(a): 4 | c *= b - i 5 | c /= i + 1 6 | return c 7 | 8 | 9 | ALL = 40 10 | CHOICE = 20 11 | 12 | print C(20, 40) 13 | -------------------------------------------------------------------------------- /Project Euler/0016.py: -------------------------------------------------------------------------------- 1 | print sum(map(int, str(2 ** 1000))) 2 | -------------------------------------------------------------------------------- /Project Euler/0019.py: -------------------------------------------------------------------------------- 1 | from datetime import * 2 | 3 | start = date(1901, 1, 1) 4 | end = date(2000, 12, 31) 5 | 6 | 7 | cnt = 0 8 | 9 | while start <= end: 10 | if start.weekday() == 6 and start.day == 1: 11 | cnt += 1 12 | start += timedelta(1) 13 | 14 | print cnt 15 | -------------------------------------------------------------------------------- /Project Euler/0020.py: -------------------------------------------------------------------------------- 1 | a = reduce(lambda x, y: x * y, range(1, 101), 1) 2 | print sum(map(int, str(a))) 3 | -------------------------------------------------------------------------------- /Project Euler/0025.py: -------------------------------------------------------------------------------- 1 | step = 2 2 | a = 1 3 | b = 1 4 | 5 | while True: 6 | c = a + b 7 | a = b 8 | b = c 9 | step += 1 10 | 11 | if len(str(c)) >= 1000: 12 | break 13 | 14 | print step 15 | -------------------------------------------------------------------------------- /Project Euler/0028.py: -------------------------------------------------------------------------------- 1 | N = 1001 2 | 3 | ans = 0 4 | 5 | ans += sum(map(lambda x: x ** 2, range(1, N + 1, 2))) 6 | ans += 3 * sum(map(lambda x: x ** 2 - (x - 1) * 2, range(3, N + 1, 2))) 7 | print ans 8 | -------------------------------------------------------------------------------- /Project Euler/0029.py: -------------------------------------------------------------------------------- 1 | s = set() 2 | 3 | for a in xrange(2, 101): 4 | for b in xrange(2, 101): 5 | s.add(a ** b) 6 | 7 | print len(s) 8 | -------------------------------------------------------------------------------- /Project Euler/0030.py: -------------------------------------------------------------------------------- 1 | ans = 0 2 | for i in xrange(2, 1000000): 3 | s = sum(map(lambda x: x ** 5, map(int, str(i)))) 4 | if s == i: 5 | print i 6 | ans += i 7 | 8 | print ans 9 | -------------------------------------------------------------------------------- /Project Euler/0031.py: -------------------------------------------------------------------------------- 1 | N = 200 2 | 3 | dp = [0 for i in xrange(N + 5)] 4 | dp[0] = 1 5 | 6 | coins = [1, 2, 5, 10, 20, 50, 100, 200] 7 | 8 | for item in coins: 9 | for i in xrange(N): 10 | if dp[i] and i + item <= N: 11 | dp[i + item] += dp[i] 12 | 13 | print dp[N] 14 | -------------------------------------------------------------------------------- /Project Euler/0036.py: -------------------------------------------------------------------------------- 1 | print sum( 2 | filter(lambda x: str(x) == str(x)[::-1], 3 | filter(lambda x: bin(x)[2:] == bin(x)[2:][::-1], 4 | range(1, 1000000)))) 5 | -------------------------------------------------------------------------------- /Project Euler/0048.py: -------------------------------------------------------------------------------- 1 | print reduce(lambda a, b: (a + b) % 10000000000, map(lambda x: pow(x, x, 10000000000), range(1, 1001))) 2 | -------------------------------------------------------------------------------- /Project Euler/0052.py: -------------------------------------------------------------------------------- 1 | # the property of "n divided by 7" 2 | for i in xrange(7): 3 | print 1. * i / 7 4 | -------------------------------------------------------------------------------- /Project Euler/0056.py: -------------------------------------------------------------------------------- 1 | ans = 0 2 | for i in xrange(100): 3 | for j in xrange(100): 4 | k = sum(map(int, str(pow(i, j)))) 5 | ans = max(ans, k) 6 | print ans 7 | -------------------------------------------------------------------------------- /Project Euler/0057.py: -------------------------------------------------------------------------------- 1 | from fractions import gcd 2 | 3 | a = 3 4 | b = 2 5 | 6 | ans = 0 7 | for i in xrange(999): 8 | a = a + b 9 | a, b = b, a 10 | a = a + b 11 | c = gcd(a, b) 12 | a /= c 13 | b /= c 14 | if len(str(a)) > len(str(b)): 15 | ans += 1 16 | 17 | print ans 18 | -------------------------------------------------------------------------------- /Project Euler/0062.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | d = {} 4 | for i in xrange(10000): 5 | s = ''.join(sorted(str(i ** 3))) 6 | d[s] = d.get(s, []) 7 | d[s].append(i ** 3) 8 | if len(d[s]) == 5: 9 | print min(d[s]) 10 | break 11 | -------------------------------------------------------------------------------- /Project Euler/0063.py: -------------------------------------------------------------------------------- 1 | ans = 0 2 | for i in xrange(1, 10): 3 | for j in xrange(1, 1000): 4 | if len(str(i ** j)) == j: 5 | ans += 1 6 | print ans 7 | 8 | -------------------------------------------------------------------------------- /Project Euler/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/Project Euler/utils/__init__.py -------------------------------------------------------------------------------- /Project Euler/utils/prime/__init__.py: -------------------------------------------------------------------------------- 1 | from func import * 2 | -------------------------------------------------------------------------------- /Project Euler/utils/prime/func.py: -------------------------------------------------------------------------------- 1 | from primes1m import primes 2 | 3 | MAXI = max(primes) ** 2 4 | 5 | def is_prime(x): 6 | assert x <= MAXI 7 | for prime in primes: 8 | if prime * prime > x: 9 | break 10 | if x % prime == 0: 11 | return False 12 | return True 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Have fun and take your time. :) 2 | 3 | ![](https://github.com/Wizmann/assets/blob/master/logo.png?raw=true) 4 | -------------------------------------------------------------------------------- /SPOJ/42.py: -------------------------------------------------------------------------------- 1 | #2012-06-16 04:20:19 Moody Wizmann Adding Reversed Numbers accepted 0.54 3.7M PYTH 2.5 2 | T=int(raw_input()) 3 | for cas in xrange(T): 4 | inlist=[int(item[::-1]) for item in raw_input().split()] 5 | print int(str(sum(inlist))[::-1]) 6 | -------------------------------------------------------------------------------- /URIOJ/1001.py: -------------------------------------------------------------------------------- 1 | print 'X =', sum(map(int, [raw_input() for i in xrange(2)])) 2 | -------------------------------------------------------------------------------- /ZOJ/1001.py: -------------------------------------------------------------------------------- 1 | import sys 2 | for line in sys.stdin: 3 | a = line.split() 4 | print int(a[0]) + int(a[1]) 5 | -------------------------------------------------------------------------------- /ZOJ/1048.py: -------------------------------------------------------------------------------- 1 | #Result: 2011-06-26 23:13:52 Accepted 1048 Python 10MS 320K 2 | import sys 3 | 4 | #sys.stdin=open("input.txt","r") 5 | 6 | sum=0 7 | for i in range(12): 8 | m=float(raw_input()); 9 | sum+=m 10 | 11 | print ('$%.2lf' % (sum/12)) 12 | -------------------------------------------------------------------------------- /ZOJ/1115.py: -------------------------------------------------------------------------------- 1 | #Result: Accepted 1115 Python 10MS 320KB 2 | import sys 3 | 4 | while(True): 5 | n=int(raw_input()) 6 | if(n==0): break 7 | else: 8 | if(n%9==0): print '9' 9 | else: print n%9 10 | -------------------------------------------------------------------------------- /ZOJ/3610.py: -------------------------------------------------------------------------------- 1 | #Result:2012-04-18 18:02:15 Accepted 3610 Python 40 320 Wizmann 2 | import sys 3 | 4 | if(__name__=='__main__'): 5 | T=int(raw_input()) 6 | for case in xrange(T): 7 | l=raw_input() 8 | l=l.split() 9 | print l[1],"will survive" 10 | -------------------------------------------------------------------------------- /itint5/python/统计完全二叉树结点数.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wizmann/ACM-ICPC/4b4ebc945a68b84b843e22b947fbb13bfe06062b/itint5/python/统计完全二叉树结点数.cc -------------------------------------------------------------------------------- /vijos/1000.py: -------------------------------------------------------------------------------- 1 | a, b = map(int, raw_input().split()) 2 | print a + b --------------------------------------------------------------------------------