instruction
stringlengths
71
95.1k
The code below runs perfectly fine as I want it to. I'd like to create more subclasses to get a better overview over the whole code. Can I place the setter and getter as well as the methods into the extended classes? I'd like to create subclasses as in 'single room', 'double room' etc., to extend room. Would it improve...
I have below code which works fine as its written in bash, i am just posting it here to see if this can be better optimised as per the BASH way. I am have an intermediate understanding in bash so, looking for any expert advise. Thanks for the reveiw and comments in advanced . BASH CODE: #!/bin/bash ###################...
The objective is to get a list of number and then switch the last person surname with the first person surname; when I type '$' it do the changes and finish the program! (POINTERS and DYNAMIC ALLOCATION). I have to use pointers and dynamic allocation, my code is nice, but I know that it can be better. How can I start t...
I have created a small selenium script that checks for available times to write a test for a drivers license. The program runs every minute and takes approx 50 seconds to run. I have noticed that it's quite unstable, and do not preform optimally because the web-page loads elements dynamically. Even if I use seleniums w...
I have modified a recursive function designed to print all the integer partitions of a positive integer to create a function that returns all partitions of the "number" parameter if they include a number contained in the "interesting" parameter. I would like to use this for very large numbers (10-50 million), but am ge...
I have a range of two columns that I want to search for a "key" and then find the corresponding value in the directly adjacent column. The key is stored in a dictionary that I populated earlier in the program. I then store the value with its corresponding key in the dictionary to display later. I am using .Find to sear...
I am communicating with a machine that sends/received structured binary data to my netcore service. The machine supplier's new library uses Memory in their library's API. I have written the following code for Ser/Des which works, but seems verbose. I know I can wrap some of this in methods/helpers, but it feels cumbers...
I'm pretty new to php coding, but i know wordpress for a long time. Also experimenting with bootstrap. I created a new Page Template and modified it a bit. What I'm looking for is to optimize this php code: <div class="row"> <div class="col kb_landing_left"> <?php global $post; $post = get_post(56)...
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it essentially peek() at the element that will be returne...
For practice, I wrote a small program that goes through a string in the data section (although, it could be easily adapted to take user input), and print out the characters in the string until it finds a newline, then stops. This is by far the most complicated assembly program I've ever written. It's the first time I'v...
Following is the piece of code which is working fine, but somehow it looks bit odd to me to have a function inside a render method and using it in both conditions. Let me know how can I improve this react code as showContainer is only adding a wrapper to the function JSX. Code - render () { const childJsx = () => (<...
I have a Pandas DataFrame that contains a row per member per day, expressing member interaction with a website. Members interact only on some days, each member is identified with an ID. Here is a simulated example: import pandas as pd import numpy as np # Generate data. ids = np.repeat(np.arange(100), np.random.randi...
I've just started my journey into functional programming and tried to implement a TicTacToe game Recursively without State in Scala. What I dislike is the JOptionPane but I don't know if i can solve this more elegantly. Does anyone know if i can solve this in a more "Scala" like way? import javax.swing.JOptionPane imp...
I am new to ASP.NET Core 3.1 with no background of MVC. I am just moving from Web Forms to ASP.NET Core. I asked elsewhere and I got the following comments regarding my code. The code is working fine for me, but I am not sure how to improve it with the provided feedback. I want to know how can I clean this code and wri...
I'm trying to use both SuperGraph as-a-library and GqlGen. So I have two handlers: the first one is SuperGraph; this checks that it can carry out the operation the second one is GqlGen; this checks that it can carry out the operation if the first one can't The code I'm using is this: type reqBody struct { Query...
I'm practicing some data-analysis and I'm currently checking the integrity of my data. The elements that do not follow my date-schema, should be funneled to a new separate list so I can work on strategies and suggestions on how to handle these exceptions. The following code checks the format successfully: def datetime_...
I programmed a Neural Network to do binary classification in python, and during the backpropagation step I used Newton-Raphson's method for optimization. Any kind of feedback would be appreciated, but mostly I'd like to know if all of the gradients and hessians were computed correctly - for the examples I ran, it seems...
I am a rookie and I need help optimizing this SelectionSort() algorithm which I have tried using Python. def selectionSort(arr,an): for lastUnsortedInteger in range(an-1,0,-1): largest = arr.index(max(arr[0:lastUnsortedInteger+1])) swap(arr,largest,lastUnsortedInteger) return arr def swap(arr,a...
I'm working through the Rust book, and it has the following example of how to use the filter method on Iterators (source): struct Shoe { size: u32, style: String, } fn shoes_in_my_size(shoes: Vec<Shoe>, shoe_size: u32) -> Vec<Shoe> { shoes.into_iter().filter(|s| s.size == shoe_size).collect() } I started ...
I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum amon...
I come from a fairly strong background of C and thought that this project would be a good way to get a handle on Rust. Right now, I have everything in one file because I wasn't sure the best way to organize the code (at least not yet). Let me know if I should post anything else (the .toml for the project, things like t...
I have been working on some code that produces a live graphic of a graph and blocks moving. It works in theory but does not look like how I want. The animation runs very slow when showing both the graph and the blocks together (a code of each alone works much better). How can I get them to work together smoothly? I am ...
During an interview I was given this interesting JavaScript task: Given the code: const testStr = "bar.baz.foo:111222", testObj = { bar: { baz: { foo: 333444, foo2: 674654 }, boo: { faa: 11 } }, fee: 333 }; ...
I did an exercise today on where the task is to write a function that returns the length of the longest subarray where the difference between the smallest and biggest value in the subarray is no more than 1. I had a solution that works but it's too slow to pass the tests that have big arrays. What is it about my soluti...
As a hobbyist programmer, I gain knowledge where I can find it from google searches. I tend to write code that utilizes threads that have infinite loops using while loops, where the while condition slaves onto a BooleanProperty that when set false, causes the thread to interrupt the loop. I use a single class to keep t...
I have a code to get riders from certain teams and calculate the number of riders in those teams in that category: valid_clubs = [] with open("validclubs.txt") as f: for line in f: valid_clubs.append(line) disqualification_reasons = ["WKG", "UPG", "ZP", "HR", "HEIGHT", "ZRVG", "new", "AGE", "DQ", "MAP", "...
This is a simple and short "Pretty Bytes" javascript function using the SI Decimal System for quantifying bytes. The code does not use complex maths such as Math.pow() or Math.log() and mainly uses strings with an array. The function uses the SI system of decimals as shown below (1 kilo = 1,000, 1 M = 1,000,000, etc.)....
I apologize in advance for my English. I have a user search method. It's parameters - login and strict. The last one determines, which method should have been used for search - Equals (strict is true) or Contains (strict is false). How should I implement it? I could do two different methods, but I think it would be cod...
I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem A full binary tree is a binary tree where each node has exactly 0 or 2 children. Return a list of all possible full binary trees with N nodes. Each element of the answer is the root node...
I wrote a function that finds the sum of all numeric palindromes lesser than N. const sumOfPalindromes = (n) => { let x = 0; for (let i = 0; i <= n; i++) { x += i == (''+i).split('').reverse().join('') ? i : 0; } return x; } console.log(sumOfPalindromes(10000)); console.log(sumOfPalindromes(24)...
Follow up question Image processing using Python OOP library I want to use multiprocessing to analyze several images in parallel: class SegmentationType(object): DISPLAY_NAME = "invalid" def __init__(self, filename, path): self.filename = filename self.path = path self.input_data = None...
I've developed task solution following a learning program: class CssSelectorBuilder { constructor() { this.selectors = [{ selectorName: '', selector: '' }]; this.order = ['', 'element', 'id', 'class', 'attr', 'pseudoClass', 'pseudoElement']; } element(value) { const it = new CssSelectorBuilder(); ...
This is just a very simple form that tells you the liquidity ratio, daily cost of running, and days cash on hand of a company, given their current assets, current liabilities, and total expense of the year. The output gives you a very simplistic of how a company might be doing financially. The required input numbers ca...
Introduction I'm new to python and made this code which computes the decay of sulphur dioxide (SO2) pollutant in a chemical reactor by ozone (O3) when it is hit by UV light. Code description Short explanation of the code: using the Cantera python package I define a set of properties for the gas (air + SO2 + O3) and the...
The code below solves the following task Find the maximum price change over any 1 to 5 day rolling window, over a 1000 day period. To be clear "any 1 to 5 day rolling window" means t[i:i + j] where j can range from 1 to 5. Rather than t[i:i + 5] if it were just "any 5 day rolling window". I used NumPy native function...
JsonStatus (as in status file) Goal A simple and fast JSON writer in C++ (JSON output only). When you need something so small that you're not sure you even need a JSON library and you don't feel like adding lots of code into your project but you also want something to take care of the commas, colons and braces for you....
I'm trying to build a simple (yet effective) brute-force protection for my App-API. The client requests an identity - the server supplies a random string (called seed, which it remembers via PHP session) and a security level. If the client wants to login it needs to supply a suffix for the seed which results in a SHA5...
I am writing an app that is supposed to simulate load on our web api and NServiceBus(particular) service. This is the first time I am writing an application like this. It appears to run ok, however it takes a few seconds before anything shows up in the console window. Is there a better way to do this? class Program ...
I have implemented a graph based on theory, and I'd like some advice regarding best practice, and thoughts about what i didn't implement that would make it even more useful, along with ideas that are supposed to be in graphs, but i missed them. I have included documentation in the code, to explain what each function do...
In my project I am using the ADR architecture, a branch of MVC. In my actions (Controllers) I handle only data that comes from the request. When there is a business rule that defines which status code I return, I do this treatment in my service. Imagine this scenario: When editing a user, I check if the user's email al...
I decided to make a password generator to get more familiar with Python. I had to break up the code into two boxes due to weird Stack Exchange highlighting with the triple quotes. How would you improve this program on the grounds of: Readability/cleanness, Performance, and Security. Feel free to include any other com...
In our project we use domain-driven design and our customer aggregate root is large. The unit tests for the aggregate root itself are simple (~50 or so tests), but I am struggling with the repository tests. Other aggregate roots in our system are not this large (number of fields), and the database table for this data i...
I am doing a research to implement a dynamic system of parse and generation of fixed width flat files in C++.... The system works, but, it is not reliable ... The class "FlatFileStructure", holds all the informations about the field in particular, such as position on the line, size, type of field (numeric, alpha-numeri...
Note: I show almost all of my code for completeness, but I really only want the review to focus on Session.hs, Handler.hs, and maybe Controller.hs. I can delete the extra code from the review or collapse it to definitions. The project I've never heard of monad transformers and monad stacks before, but I've decided to l...
To sum up all the nodes' depths in any given binary tree, I've written the following recursive algorithm: def nodeDepths(root): final=[0] helper(root,0, final) return final[0] def helper(node,d, final): if not node: return final[0]+= d helper(node.left,d+1, final) helper(node.right...
Proteins are chains of amino acids. Amino acids are coded by codons, a sequence of 3 DNA/RNA molecules. DNA also has 3 open reading frames. This is basically the DNA sequence, but shift it by 1 (i.e. ignore the first entry). Thus, you will have 3 different translations (no skipping, skip 1st entry, skip 2nd entry). Add...
I'll try to publish a paper about the programming language I've made (ArithmeticExpressionCompiler, short AEC) in Osječki Matematički List and, in order to demonstrate its usability for implementing algorithms, I've tried to implement a fast sorting algorithm in it. The basic idea of my algorithm is that QuickSort work...
How can I make the solution to this https://www.codewars.com/kata/5506b230a11c0aeab3000c1f/train/fsharp more "functional"? module Evaporator let evaporator (content: double) (evapPerDay: double) (threshold: double): int = let minUsefulAmount = content * (threshold / 100.) let evapAsPercentage = evap...
I'm trying to work up to being able to print the hailstone sequence in assembly. To do that though, I first needed to learn how to actually print a number out using the write system call. After a few design iterations, I ended up using division to get each digit one at a time by using the remainder. Each remainder gets...
I'm wondering if there are better practices, and optimizations I could make on my code, to do things easier/faster. I have added comments, in many places in the code, to make understanding easier. import sys class Node(): def __init__(self, data): self.data = data # holds the key self.parent = Non...
This program takes a text file and parses the initial cube start position, the pattern that the result should have and an optional start sequence. The cube is using numbers instead of colors for more exact positioning. Each face is represented by 9 numbers 3 rows of 3. The top face would be 1 2 3 4 5 6 7 8 9. The left ...
I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Return the length of the shortest, non-empty, contiguous subarray of nums with sum at least k. If there is no non-empty subarray with sum at least k, return -1. Example 1: Input: nums =...
I have an object with three possible properties: consistencySelector = { transaction: "kkjk4k45kjlkf"; newTransaction: {}; readTime: "sometime"; } I would like only one property to be present at any time using the following definitions: interface Transaction { transaction: string; newTransaction: never; re...
Problem Statement You are receiving n objects in a random order, and you need to print them to stdout correctly ordered by sequence number. The sequence numbers start from 0 (zero) and you have to wait until you get a complete, unbroken sequence batch of j objects before you output them. You have to process all objects...
I built this basic in-memory database that can support some basic operations, like SET, GET, DELETE, COUNT, etc. As well as support transactions. Some of the constraints are as follows: GET​,​ SET​,​ DELETE​, and C​OUNT​ should have a runtime of less than O​ (log n),​ if not better (where ​n​ is the number of items in ...
I have a video component passing data from an async GET request to a child component: // Inside a v-for loop <video :title="video.title" :id="video._uid" > // ... <Controls :videoData="video" /> When receiving the prop in Controls I then use that data to select the video by it's id in the DOM and set data prop...
The question is from Leetcode. Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range...
I am slowly creating a flow field pathfinding solution for Unity3D. I'm trying to follow Elijah Emerson's description, which appears in the book 'Game AI Pro' (volume 1). The map is divided into sectors, and each sector houses three fields: cost, integration, flow, which need each other to calculate the flow field. At...
I've done my best to contrive an example of the problem I'm trying to simplify. I have a pool of workers, and each worker can do several tasks at a time. Each task takes an unspecified amount of time. The goal is to drain the task queue by keeping each each worker as busy as possible. In order to accomplish this, once ...
Given an object with unsorted numeric values, such as: const unsorted = { green: 80, blue: 90, red: 30, yellow: 100, } We want a data structure with the same key/value pairs sorted in descending order of the values, e.g.: const sorted = { yellow: 100, blue: 90, green: 80, red: 30, } My solution: funct...
I'm beginning a redesign of the front end of my Flask app which currently generates Jinja2 template-based html pages. I am trying to develop a new front end in React, but I want the current front end to continue to exist. Much like Reddit, I want my current front end to exist at old.anno.wiki and the new front end to e...
Through my previous questions, I developed a web-scraper that gets tennis ranking data. Webscraping tennis data: major refactor of code style and program modularity Webscraping tennis data 1.1: improving exception handling In this version, I'm back with some modifications for my scraper based on my goals for the over...
Following takes a range & copies, pastes, transposes & links. There doesn't seem a way in vba to do this in 1 go that I've been able to find. Questions are; Is there a more efficient or safer way to do this. Keeping in mind; -needing to do this for large ranges ie. over 100K cells. -source & destination are in differ...
I have this api endpoint where i want to lookup a user or multiple users schedule and also specify the month or/and the day when doing the query. My code works, but i feel like there is a better, cleaner way to do this. From the frontend i do a get request that has the following query params. http://localhost:5000/api/...
I was trying to implement a queue implementing the small size optimization. I was wondering any ways I can make this code better (more performant, better code style, etc). It seems to work fine (in terms of correctness). For reference, Global::specifyError is my error handling mechanism for the project, Global's alloca...
Please critique the following code on removing a node from a singly linked list, at the moment it seems to me like the code is quite clunky. typedef struct Node { int data; struct Node* next; }Node; Node* create(int A[], int n){ Node *head = malloc(sizeof(Node)); Node *temp = NULL; Node *tail; ...
I have been working for a few days on writing get, set, and clear bitwise functions in JavaScript to clear not individual bits from an integer n, but to clear entire ranges of bits in n. For example, using the functions below, I would expect this behavior: getNumBits(0b101) // 3 getNumBits(0b10100000) // 8 // getBitRa...
The task is to write a simplified version of Ruby's String#count method oneself. Simplified because it doesn't have to have the negation and sequence parts of the original. Here my solution: def custom_count(string, search_char) sum = 0 seg_string = string.split("") seg_char = search_char.split("") for...
My goal is to make a class that wraps the complexity of OpenCvSharp implementation to show a webcam streaming into a WPF Image. You can find the complete code with a running example (just clone and compile) on my Github repository. The important code is this: public sealed class WebcamStreaming : IDisposable { priv...
I've made a Python Flask app and I have some questions about the structure of the main module (equivalent of index.py). Here is what it looks like: from flask import Flask, render_template import database as db import weather_forecast as wf import os app = Flask(__name__) @app.route("/") @app.route("/home") d...
I have created a program where I first set the size of the array and how many times I will look for consecutive values, then I fill in the array and finally I insert the consecutive values, it should look for the least consecutive value it finds in the array. consecutive value means the sum of the elements in the array...
I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem A message containing letters from A-Z is being encoded to numbers using the following mapping way: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Beyond that, now the encoded string can also contain...
I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Convert a non-negative integer to its English words representation. Given input is guaranteed to be less than 2^31 - 1. Inputs 123 1234567891 151 1414312 1234 1241234113 Outputs "One Hu...
I am creating a social network and I want to know how secure and clean this code is. I had to update it to prepared statements because I was following a tutorial and even though it was made in 2019 it was using 15 year old code. So can someone tell me if it's good or needs improvement ? Thanks. <?php include("includes...
Background: I'm implementing an algorithm from the paper Polygon Area Decomposition for Multiple-Robot Workspace Division and one of the steps is to represent a polygon as a graph. This is done by splitting a polygon to convex parts that will become the nodes of the graph, and the edges of the graph will represent thos...
I teach programming, and I currently teach my class about inheritance, abstract classes, and mixins. I wrote this code as an example, and I want to be sure it is as good as possible before I release it as a code example. Few assumptions: The code should only handle piece movements and not manage an entire game. The co...
I am currently writing python code that scrapes information from the web. I have to scrape several sites, but there a two types of procedures: Directly scrape from the website Download pdf and scrape it with regexes I consider the following 3 options, which one would be recommended? Option 1 Use inheritance: import r...
Firstly, here is the relevant code. It is written in kotlin. package com.minz.tournaments import kotlin.math.ceil import kotlin.math.log2 import kotlin.math.pow @OptIn(ExperimentalStdlibApi::class) class TournamentTree(initialParticipants: Map<Int, Participant>) { private var rootNode: ParticipantNode private val par...
I am trying to convert objects inside an object(arbitrary objects) to Json and later retrieve it. I have developed some codes and would like to share if there is any problem in the code. import json Here is the first class class Foo(): def __init__(self,x,y,bar): self.x =x self.y = y self.b...
My goal is to make a very simple library with the authentications basics: create a user and save its hashed password, change its password, have a method to check if the password is correct for login. The usage I thought (you find everything in my Github repository), is this: var cs = "Data Source=localhost\\SQLExpress;...
This code finds which "secure file erase" command exists on the system. It used to simply test for "shred" and pick "rm" as a default. Now it is a bit more complex since I've ported the code to operating systems with "srm" and "rm -P". Is this still cleanly written? How can I improve it? var shredPath, shredFlag st...
This script was previously reviewed here: Part 1: Create or update record via HTTP request I've made the changes that were suggested by @Reinderien. Now that the code has been significantly refactored, are there any other improvements that could be made? Description: I have an external system that sends an HTTP reques...
I have an api endpoint that, when called, initiates the generation of a report. This is time consuming process and response could come pretty late. So, we came up with caching architecture and once finished the response is saved to redis. However, on the frontend side we dicided to make a request once in a while, until...
I had a need to build a standardized layout for content on many of the pages of my website based on data returned from my web service but the project I'm doing this on is already bloated with stuff from previous developers and since I don't know what I can take out without destroying functionality, I needed a way to do...
I've written a little program that I need for fixing two problems in my spherical panorama images. It does two things: If the image does overlap horizontally, it cuts away the overlapping pixels from the right side. It fills up the image vertically with black, so that it has a ratio of 2 to 1. I'm not too experienced...
Having coded in Objected-Oriented style my entire programming career, it's hard to adapt to functional style fully. I implemented a simple Hangman game: {- A simple gameLoop of hangman.-} module Hangman where import qualified Data.Set as Set import qualified System.IO as IO import qualified System.Random as Rand impor...
Is there a better way of doing this? I heard that BinaryReader and Exif parsing to get the property item is faster, but I have no idea how to do that, thanks for the help. //we init this once so that if the function is repeatedly called //it isn't stressing the garbage man static Regex r = new Regex(":"); //retrieves ...
I'm stepping back into Android after being away from it for about a year. Trying to get an out of date app of mine back on its feet, and continuing work on it. The app was written using Java, MVP, Realm, RxJava, and Dagger. I am trying to update it to use Kotlin, MVVM, Realm, Coroutines and ideally dropping Dagger, as ...
I made a Java quiz program. The program will let you take the Java quiz and then display the quiz's result according to your score. /* * Java Quiz * by Clint * 2020.07.07 * This Java program let's you take a quiz. Quiz are taken at: https://www.w3schools.com/java/java_quiz.asp */ import javax.swing.JOptionPane; ...
I am working on 957. Prison Cells After N Days but getting timeout error for my code. as I assume my code should be 14+O(n-14) about O(n) am I right since after 14 run pattern will be repeated? and how can I improve my code? from collections import defaultdict step_map = defaultdict(list) for k...
The ubiquitous dplyr package has the function mutate_at (and many other *_at()'s), which allows us to perform a similar operation on multiple columns. Using purrr-style formulas, the relevant column is indicated by .: df %>% mutate_at(vars(colA, colB, colC), ~ 2 * .) This would double the values in the respective colu...
I have been learning MVVM and I have decided to create a small framework for simple MVVM programs I can make in the future. This program provides navigation between a main menu, settings menu, start menu, and exit button. There is no functionality yet, and this is because I want to work on the navigation framework befo...
The source code of this project aims to enable defining contact information either via FrontMatter or named parameters, and having that information then formatted to HTML that is both human and machine readable. I've attempted to adhere to the MicroCode specifications for both HCard and VCard formats, and allow for eas...
I am trying to create a list based on some data, but the code I am using is very slow when I run it on large data. So I suspect I am not using all of the Python power for this task. Is there a more efficient and faster way of doing this in Python? Here an explanantion of the code: You can think of this problem as a li...
In react I have a HTML Element Factory, it allows several different types of form elements to be created most with the same onChange but some have specific uses. I have been capturing them in this switch, but its time to refactor, what should an onChange() switch be converted to, should this too be a factory? Or just a...
I created a syntax highlighter in JavaScript. The language it highlights is AdBlock Filter Syntax, the language used to write filters for ad blocker extensions in browsers. Shown here is the AdBlockSyntaxLine Class, which is the core class that dices a line of text into categories. These categories are used to do highl...
Looking for feedback on this code to reverse a double linked list. Things I am potentially looking for but missed -> redundant operations, extra / unnecessary arithmetic, improvement in code style. Thank yoU! typedef struct Node { int data; struct Node* next; struct Node* prev; } Node; void reverse(Node*...
A few days ago I posted my password generator project to help me learn and become more comfortable. I got a lot of great replies from that and I've sense updated and would love another look at the program. I've made it so that I can import it and use it to generator a password. I've also added support for completely cu...
I'm using Temporal Tables on postgresql (https://github.com/arkhipov/temporal_tables) and C# with dapper. I'm storing an entity together with its changes. Here's an example entity, with an Id and two values. It was created in 2006 and underwent two simultaneous changes in 2007 | ID | IntValue | StrValue | sys_period ...
I came across this question in a coding competition (Java-restricted) and I got a time-length-exceeded. I am unable to provide a link as the contest is closed now. Can I know how can I optimise this? Unique Subsequences: You are given a randomly generated string of characters ranging from a to z. You are required to ...