instruction
stringlengths
71
71.9k
Click the divs to remove them. Remove all div's in the shortest time and minimal clicks (to do). Code needs streamlining. <!DOCTYPE html> <html> <head> <style> div { width:30px; height:30px; background-color:blue; position:fixed; } </style> <script> function init() { var i; count=10; for (i=0;i<10;i++) with (docu...
Devise an algorithm that will operate on a number x and a set of n distinct numbers such that in \$O(n \lg n)\$ time, the algorithm indicates whether or not there are two numbers in the set that have a product of x. Explain why your algorithm works. My algorithm: Sort the set //\$ O(n \lg n)\$ For every element in t...
Basic Info I needed a lock-free ringbuffer with multiple readers (but one writer). However, I did not want the writer to check all readers every time in order to prevent an overrun. Thus, I decided to split the buffer in two halves. If the write pointer is in one half, it is only allowed to advance to the next half if ...
I have sample graphs like the following (un-directed un-weighted cyclic graphs). My goal is to find the shortest path between a given source and destination. I have found this implementation on web and have made some modifications only. How can the code be improved? Are there any gotchas that I need to take care of? fi...
This is the code I have: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct island{ char *name; struct island *nextIsland; } island; void printIslands(island *i){ printf("%s\n",i->name); if(i->nextIsland != NULL){ printIslands(i->nextIsland); } } island* fileReader(...
This is a game of math in Poker. Two people each have a pile of cards. They then each place 2 cards on the table at the same time. Every card is treated as a number. The players need to find a way to calculate 24 from the numbers. For example, you are given 3 5 4 8, and you can get 24 by (3+8-5) * 4, or 8*4-5-3. This c...
I have written the following service class for my application and at the moment it only contains a single method which is responsible for carrying out the necessary actions to add a new team to the database. More methods will be added later but I want to make sure that I'm on the right track with regards to OOP and it'...
I am trying to implement A* search on a grid in MATLAB. I am currently using a priority queue class I found here, but it's a bit slow. I tried to write this simple priority queue class in MATLAB: classdef PQ2 < handle properties nElements indx; priorityList; valueList; end ...
I have written the following class which is part of a pagination system in Wordpress. The class works as expected and also works as expected when used in the system. Just as background, the class performs the following task Takes an array of post ID's and creating links to the posts which ID's is supplied in the arra...
I've created a function in C to reverse a singly-linked list in place: typedef struct n { int key; struct n* next; } node; node* inplaceReverse(node* head, int index) { if(!head || !head->next) { /* Indication of last node (or empty list). This will be recursively returned to become the new head po...
1-20 of K&R Exercise 1-20 Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns. I think my solution is okay. I used the name getlinea when it also "completes" a line when returning from function get...
I just did CodeChief's candy splitting task here and my code is working even with a lot of test cases and big numbers, but it uses way too much memory. When I checked my submission, it was 1342M, which is a lot. import java.util.ArrayList; import java.util.Scanner; class Candies { public static void main(String[] arg...
Can anyone comment on the efficiency of my code? I am new with Python using NumPy/SciPy and I am trying to program a lattice biological model where a certain (one and only one) species (represented by a nonzero element) occupies a lattice square (represented in the code by a 2D array). This species can reproduce to an ...
Below is the code that implements sequence abstraction using type abstraction Sequence (in Java): /** * * @author mohet01 * * @param <T> */ public class Sequence<T>{ /** * Abstract data type constitutes constructor and selector functions * written below under representation that hold below invaria...
I've just started iOS development and learning Swift. My code below works, but I'm interested to know in ways I can improve it having no experience in iOS Swift prior to this attempt. import UIKit class NewsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { var tableView: UITableView! var t...
Questions: Is there a better way other than assigning IDs manually and creating separate lists for each model the way I have? (for this particular scenario). If so, how? (Still taking the conditions into account) The conditions are: Through an external source get a list of unique book names with their correspondi...
Sort a stack in ascending order. You may only use one additional stack to hold items. Any comments on my solution? Worst case complexities: Memory complexity: O(n) Runtime complexity: O(n^2) Also, I implemented the Stack class as having Object items and then cast these into Integers to be more general. Is this a good ...
The purpose of this code is to generate the CSR and the Private Key. The scenario is that we have some clients for whom we run websites and for the SSL component we want to have a page on our site where they can input the fields like domain name, company name etc and then the system will generate the CSR (and return it...
I'm not exactly sure if this is technically an "arena allocator" but it serves a similar purpose: providing a fast way to allocate a lot of objects that can all be freed at once. #include <type_traits> #include <utility> #include <new> template <std::size_t BlockSizeIn = 1024> struct BlockProviderNewDelete { stati...
I'd like to use JavaScript to generate HTML. I've made a JavaScript function object that has two parameters; a string and generic object. The string is used to specify the type of HTML element you want to generate and the generic object is a container for key value pairs specifying the element's attributes -- or a stri...
The following function works fine. However, deleting 1 mail takes about 4 seconds (from start of operation to the firing of the completion handler). Currently, using mailcore2, copying mails on the Gmail server. Are there any significant issues? func deleteOnServer (indexSet: MCOIndexSet) { NSLog("will delete ema...
There is a job interview question, and the source of the question is here. The solution is pretty simple. We just need to split the input string by + and then by *. Then we compute products in a nested loop and sum up all the products. public class Main { // http://www.careercup.com/question?id=4911380140392448 ...
Due to being unable to ask a C programming language expert or advanced user in person, I'm posting this simple question about my C code. Today I was refreshing my C with exercise 5.4 of the C programming Language 2nd Edition by K&R, which is a very simple exercise: Do you think that my way of handling pointers is 'ver...
Compile time checking of printf-like format strings Inspired by this open ticket on boost, this seeks to complete the work there Given a printf-style format string and associated arguments, a static_assert is performed on whether the format string and arguments are valid. I'm particularly interested in: Have I covered...
I'm trying to transition from JavaScript to PureScript (a Haskell spinoff that transpiles to JavaScript). For starters I coded this: getAt :: [String] -> Number -> Number -> String getAt strings x y = case strings !! y of Nothing -> " " Just line -> case charAt x line of Nothing -> " " Just char...
I've put together an algorithm for an assignment. I've done my best to try and keep it to a professional and readable standard. I'm posting it here so that I can get some feedback and suggestions on what it's like and whether I could improve the algorithm in some way. /***** Algorithm Comments - Name: Shivan...
I'm using a Python script to run a particular program that occasionally may need to be terminated (by receiving a SIGINT or SIGTERM) in which case a clean up process needs to be invoked (before killing the original process). To test it I start the program in question and then I send a SIGINT to terminate it. A signal h...
I was reading some gameprogrammingpatterns (awesome book, by the way, would recommend) and was very excited when I learned that unions are a thing that exists, so I decided to implement an object pool as outlined there. I'm looking for a review of the usual culprits. Poor readability, not making use of standard library...
Program: Given an array A of size N. Given Q operations, each operation contains an integer D. In each operation you have to divide all the elements of the array by D. For example, for each operation with a given D, the new array A would be: Finally, after processing all the operations you have to print the fi...
This is a script that I use on a Google sheet for parsing data that has been pasted from various other software and getting it into the correct format and columns on another sheet. Data is pasted into the "CL" sheet where it is parsed and formatted via formulas on the sheet. The data is then sent to either just the "W...
I'm kinda new to Java (<1 year) but have some background in C and Python. I've come up with a working solution to Project Euler Problem 4 - Largest Palindrome Product. However, I'm not confident this is "Effective Java"... All suggestions for improvement are welcome. I'd especially like feedback on the following: Java...
Created for a console application that will be run in the background on a linux system, giving me a nice way to gracefully shut it down by simply deleting a file (which can be done via script/etc.) public class BlockOnRunFile { private File watchedFile; private Path path; private WatchService watcher; ...
I have a programming assignment where I need to build a webserver which can handle GET and HEAD requests. My webserver is working as it should but since I'm still a newbie at Java I'm not sure about my structure or quality of my code so if you have some criticism/tips I would appreciate it. Main: package pytteweb; imp...
I'm new to Java and wanted to present to you my latest project: Ulam Numbers /** * This class consists of some instance variables a constructor and some getter and setter methods * It is supposed to implement the Ulam numbers which are named after Stanislav Ulam * Furthermore we will make use of the numbers to cal...
Background: I'm building a dynamic in-house on-call roster that will be displayed on a web page. The end user will be displayed a list of people who are currently (at the time of the database call) on-call for various organizations, departments within the organization, and offices within the department. The basic rule...
Help me find out if the approach I took to generate random strings here is correct to be able to return the appropriate short URLs. import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Random; /** * * Given a input string create ...
I have a piece of code that is fetching account objects from a service private Account searchAccount(String accountId) { try { Account account = service.search(accountId); return account; } catch (Exception e) { log.error("searchAccount failed", e); e.printStackTrace(); }...
I am using OpenCV 2.410 to implement a project. My project allows to segment head from video sequence which get from camera. First, I detect the head region and then apply segmentation method for that ROI region. For high accuracy segmentation, I have chosen the Grabcut method. However, it is very slow. I only achieved...
So I've been making a trivia game with SFML and C++ for quite a while now for my school project and I would like to get some constructive criticism, anything helps from best practices to overall correctness. Everything on GitHub for readability Here goes main.cpp: #include "Trivia.hpp" int main() { Trivia trig; ...
While reviewing a C question I started writing my own implementation and in no time I had a completely refactored completely different implementation. As the asker is learning I did not want to post it, instead I ask you for further review and possibilities of improvement. #include <stdio.h> #include <stdbool.h> int g...
Consider following example (controller): MyController < ApplicationController def index @objects = Object.fancy_way_of_retrieval @properties = Property.fancy_way_of_retrieval_two @something_else = @objects.do_something end def another_method @something_other = SomethingOther.get_va...
I need a hoverable transparent animation for a website, so that it glows when the mouse is over it. I could use two gifs or svgs one on top of another, but (as far as I know) there's no control of the current frame so I tried spritesheets with JavaScript and an if/else inside of every image in order to show the hovered...
I'm making a old-school Final Fantasy type game and I made a tile map class a while back and posted it on here (Is this a good way to implement a tile map from a text file?) But, when I got to collision, it was a nightmare. So I've updated it to make it more collision friendly and I was wondering what the community's t...
I recently did an Android Minesweeper app for a pre-interview coding challenge before I could talk to any engineer and was rejected. This feedback was given but I'm not sure on some of it. ☺︎ Game works Very minimal implementation (well, I did what was required...) No separation of logic, entire game crammed into Ga...
Here's my solution for finding the digital root of a number. Just for purposes of completion, a digital root is: "If you take the digits of any number and add them together, and then add the digits of the resulting number together, and continue doing that until you get a single digit, that single digit is the digi...
I have to implement a genetic algorithm in R to optimize the minimum of the Schaffer function. Below I describe each step and I need to create one big function and another loop for 100 iterations (and from 100 iterations choose the best solution) for the Schaffer function. I would be grateful for any tips, where and ho...
I am trying to understand the basics of responsive web design using bootstrap. So, is this a good way of structuring the layout of a responsive web page or are there any other/better alternatives? Here's the Gist of the entire file(login page), just in case if you want to download and test. HTML: <body> <!--START-PAGE...
I am following the Stanford iOS 8 lectures and I believe I have successfully added the "Clear" functionality to the application, but I don't know if I am doing it properly. Controller import UIKit class ViewController: UIViewController { @IBOutlet weak var display: UILabel! var userIsInTheMiddleOfTypingANumb...
This is an update from An Update on my TileMap Class. It's a tileMap class for a top-down old-school final fantasy game. User @Tim gave me suggestions and I updated some of the code accordingly. Tile.java import com.stardust.rpgtest2.gfx.Assets; import java.awt.image.BufferedImage; public enum Tile { Grass(1, Asse...
I'm trying to implement fftshift from matlab for OpenCV. Can you please review the correctness of my algorithm? Have I missed something? Also, is there a better and faster way to do it? cv::Mat ff; cv::dft(distanceF, ff, cv::DFT_COMPLEX_OUTPUT); //Make place for both the complex and the real values cv::Mat planes[] = ...
Does this implementation guarantee execution of \$O(n)\$ time? What is the additional space utilization for this implementation by excluding the original array size? Is it \$O(1)\$? #include<iostream> #include<set> #include<algorithm> bool ArraysPermute(int array1[],int size1, int array2[], int size2) { ...
I tried to write my first jQuery plugin. It's a very simple AJAX file uploader. HTML <input type="file" id="upload" multiple="multiple" /> Plugin ;(function ($, window, document, undefined) { // Function-level strict mode syntax 'use strict'; $.fn.ajaxUpload = function(options) { var defaults = ...
I'm just starting with rails and testing, and not sure what's good way to dry code like this. require 'rails_helper' describe EventsController, type: :controller do let(:admin) { create(:user_admin) } let(:mod) { create(:user_moderator) } let(:user) { create(:user) } let(:link) { create(:link) } let(:event)...
The following code handles querying for user data in a multitenant Cassandra database. Each tenant has their own keyspace and within that keyspace data about each tenants users is stored. This code will run as part of a webservice. I'm looking on comments for how I handled managing the session so that connection pooli...
I wrote a simple text editor and I would like to get some critical comments. Below I present only a main part of code. I removed icons, irrelevant functions, etc. I am aware,that JTextArea is not best choice for text editor, however I purposely didn't choose JTextPane because at my level it seems too complicated. I wo...
The Rubberduck project is coming along pretty nicely, and for the next version the parsing strategy is getting yet another revision, and this time around it really feels like it's done right. Or is it? The idea is to walk the parse tree once to locate every single declaration. Here are the types of declarations we're t...
I'm trying to keep the code as clean as possible. Is this the best approach? I don't use jQuery that often. // ============================================== // Trigger longer description on product page // ============================================== var longDescription = $j("#js-long-description"); var shortDescrip...
I have recently been teaching a JavaScript module on a games programming undergraduate course and I made this game as a learning exercise and as an example for my students to study. I have made games before but never in JavaScript. Could you have a look at my style and let me know if there are any obvious improvements?...
This is a follow up to my previous post from 7 months ago. I changed up the algorithm a little. Instead of inserting items into a new list, each item's final place is calculated up front. Sort of like if instead of resizing an array each time I add a new item, I'm sizing it up front and just setting the value of each e...
This code belongs to a shopping cart which I want to print multiple times with the help of a loop. There are 9 SQL queries and I want all these queries to run at a time with the below table every time the SQL query changes, but the below table remains the same. //SQL query define in array $query = array(...
I need code review for using ASP.NET Identity in a new app. Goals: Use int instead of GUID for IDs. Separate identity from view layer I need code review if I did everything right. Yes it is working but maybe I did something that I shouldn't or maybe there is some place for improvement. ApplicationUser public class Ap...
A colleague and I were discussing the following code today and had a disagreement over the return false in the catch (MalformedURLException e) block. For some background information this method is in a class which is going through legacy data to be migrated into a new system, parsing the text, finding all of the <a> ta...
This should implement a stack that has a \$O(1)\$ getMin method. I used an auxiliary stack. Please provide comments on my solution. import org.junit.Test; public class Solution { @Test public void testEmptyStack(){ StackMin<Integer> s = new StackMin<Integer>(); System.out.println("----------------------")...
This script to locate torrent files in a given directory, and if they have been seeding for 2 weeks, delete the files. I realize the comments are overboard. The reason for that is it's being shared with people who don't program. What should I have done differently? import os # for listdir(), path(), remove(), and ge...
I need to be able to do a select to a table using a where clause that can use an email or phone field, depending on if they are set/not empty or not. Given this context, how can I simplify this PHP code? if(isset($email) && !empty($email) && isset($phone) && !empty($phone)){ $partQuery = 'account_id = '.$accou...
I've put together an AES encryption implementation to solve a set of requirements. I believe that I've met the requirements, but I'd like to see if anyone is willing to review the implementation to ensure that my crypto approach is sound. Requirements Static symmetric encryption API composed of Encrypt(string) and De...
Am I making good use of the Rust language and APIs? What can be improved? extern crate rand; use std::old_io; fn main() { println!("Guessing Game"); // declaring the type in the left side of let helps random() return the right datatype // An alternative is: let answer = (rand::random::<u32>() % 100) + 1; ...
I’m trying to rewrite one of my projects using the MVVM pattern. I have a feeling though I’ve not done it correctly because I think my Model is too “smart”, it has methods to modify its own datamembers. I’ve seen in examples that people put validation in there but that’s about it. My Model class inherits from INotifyPr...
The intent of the below code is to find all interfaces within a solution whose fully-qualified names match the given predicate. It seems to work, but as I am new to Roslyn I'm guessing there are things that could be improved. I'd appreciate any pointers. public async Task<IImmutableList<INamedTypeSymbol>> GetMatchingIn...
This is the first thing I've written in Perl besides one-liners. It just generates random text based on a text file. I was inspired by this. Any tips on making this better are welcome. I'd especially like to know if there are more idiomatic ways I could do certain things. #!/usr/bin/env perl use strict; use warnings; u...
Given a beginning and ending point, check how many numbers are palindromic. My solution is a bit clunky. How could it be more elegant? import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Palindrome { public static void main(String[] args) { Scanner sc = new Scanner...
Background lodash and underscore have an invert function that takes an object hash and converts it to a new one, which has keys as the input object's values and values as the input object's keys. As such, if the values in the input object aren't unique, this non-unique input value will, when it's a key in the output ob...
I have a URL in this format: http://localhost:57279/AssociateCaseDetails?UId=176948&caseID=1123 I need the values of UId and CaseID: var UId =window.location.href.split("?")[1].split("&")[0].split("=")[1]; It’s working, but is there a better way to access the same, given the same URL?
I'm struggling to make my lambdas readable. I've seen various approaches. Below are three different examples that all do the same thing. Forgive the example: I suspect there are better actual solutions to this problem. I'm only concerned with readability (and ultimately supportability). /** Output any items that are p...
After considering the suggestions of my previous question, Check whether given a pair of arrays are permutation of each other, I changed the code. Resolved the bug reported earlier In place of std::set using std::unordered_map to attain \$O(n)\$ complexity In place of indexing array used std::array #include<iostream>...
This structure is supposed to iterate over the lines of an input stream, using std::getline. Any remark is welcome! #include <iostream> //istream #include <cassert> struct line_iterator { explicit line_iterator( std::istream & is ) : m_stream( &is ) , m_line( extract_line() ) { } l...
I think the following is thread safe. Am I right? How would you improve this code? Are there new APIs or methods I can use? Data: public class Data { private int value; public Data(int value) { this.value = value; } public synchronized int getValue(int mTrhead) { System.out.println("MyTrhead " + mTrhea...
I have this simple code in Python: input = open("baseforms.txt","r",encoding='utf8') S = {} for i in input: words = i.split() S.update( {j:words[0] for j in words} ) print(S.get("sometext","not found")) print(len(S)) It requires 300MB for work. "baseforms.txt" size is 123M. I've written the same code in Has...
1) Postgresql 2) User has_many :reports 3) Report belongs_to :user 3) Report belongs_to :publication 4) Publication has_many :reports 4) Publication scope :photos, -> { where(publication_type: 'Social::Photo').where(show: true) } 4) Publication scope :tweets, -> { where(publication_type: 'Social::Tweet').where(show: ...
I have a below method in Java 8 which checks for message pattern and finds the line number from the message. private LawfirmInvoice getInvoiceForErrormessage(InvoiceParcel parcel, String message) { if (parcel.getInvoices() != null) { if (parcel.getInvoices().size() == 1) return parcel.getInvoic...
The following code reads a file, splits its data, replaces some characters in the data, and then joins the data again (I added more details in the comments): // read plain text file and make content available in data fs.readFile(filename, 'utf8', function(err, data) { if (err) throw err // turn the data into an ar...
I am currently trying to teach myself scala by rewriting projects from my intro CS class, which was taught in C++. In addition to just learning the syntax I am trying to gain understanding of how functional programming works and what is considered good functional programming style. Below I've included both the origina...
I have this simple implementation for array sorting: #include <iostream> #include <stdlib.h> using namespace std; // some magic for the sorter int compare(const void *i, const void *j) { int a = *(int *) i, b = *(int *) j; return a < b ? -1 : a > b ? 1 : 0; } int main() { int arr[100], temp = 0, count = ...
Inspired by this comment I decided to implement an iterator adaptor that takes another iterator and returns each element and a given number of its neighbors. The final solution should be applicable to most iterator types but this review is only about my first solution for random access iterators and can be found here. ...
The previous and initial iteration at Simulating a GUI windowing system I have essentially cleaned the code based on the only answer. Now I have: MyCanvas.java: package net.coderodde.gui.simulation; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.even...
I'm implementing a quick-and-dirty lock-free MPMC queue in C++, based on the v3 Disruptor algorithm. The implementation is pretty simple: Data to be shared between threads is stored in a ring buffer. The ring buffer maintains a sequence number that points to the next available slot. Consumer threads maintain their own...
For eligibility to events I need to know the age of a competitor at a specific date. Now the thing is the date calculations are checked in two places, an online PHP app where the entries are registered, and an offline Java app that runs the events. So I have 2 versions of the same code, the PHP one was written original...
I created this function and I'm unsure if it is sufficient for "real world use", because all code snippets on the net I found for recursive copy functions used functions like $hDir = opendir($sSrc) which I don't think are necessary. That's why I like to have my func checked by some PHP professionals: It recursively co...
I have a method which extracts filedata and converts it into a String array: import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import org.apache.james.mime4j.message.BodyPart; import org.apache.james.mime4j.message.Message; import o...
I have some embarrassingly long code which puts into words any number up into the trillions. As a newbie, and understanding that shorter, non-repetitive code is best, I am looking for suggestions on how to reduce this code to a respectable quantity. I realize that there is a lot of repetition in it. However, depending ...
This implementation of discriminated union based on C++ inherent unions and inspired by this and this articles. #pragma once #include <type_traits> #include <limits> #include <utility> #include <cassert> namespace versatile { namespace type_traits { template< typename from, typename to > struct copy_ref { usi...
I have a property (called "Head") that can be set externally. When "Head" is not set, it uses Unity3D's MonoBehaviour functions to try to find the best value for "Head". I started with a nested if, but the nesting was starting to get out of hand. if (Head == null) { Head = this.GetComponent<Camera>(); if (Head...
I often work with angles when writing code for 3D rendering and such. Personally, I prefer to measure angles in degrees, but many APIs (including the Standard Library) measure angles in radians. So more than once I have produced bugs by passing an angle in one measure when the function/library was expecting it in anoth...
Today, something possessed me and I started learning assembly. My poison of choice is the lc-3, this is my very first program. It is actually only the first part of a two part problem, but this already took enough that I thought it merited a review, just in case the day's insanity also expressed itself in my code. It ...
Inspired by this open ticket on Boost, this seeks to complete the work there. Given a printf-style format string and associated arguments, a static_assert is performed on whether the format string and arguments are valid. I'm particularly interested in: Have I covered all possible format strings? Am I doing this in th...
Considering I have an iterated "lists of lists ..." (up to 4 dimensions), now I wish to make the full list "rectangular" (or well each dimension equal in size). For a 4 dimensional case I've written out a specific version: x=[[[[4,3,4,5],[1],[2,2]],[[3,6,7],[2,3],[1]]],[[[1]]]] length0 = len(x) length1 = len(sorted(x,...
My web API has 3 controllers for get, post and users CRUD. I named it as DetailsControllor, FormControllor and AuthControllor. In the details controllor, I used a switch case to find out which type of details needed, but I found that code is repeated in switch case. Can I use generics to minimize code or is there any o...
I am trying to solve for the problem with a bunch of intervals: (1,2),(2,5),(4,7),(9,11) I find their union, which in the above given case would be: (1,7),(9,11) It will be great to get some feedback on whether I am on the right track and how I can improve upon what I have. import java.util.Collections; import java.u...
I have written some code which makes a button morph into a container. I have written it using prototypes. I am fairly new to jQuery/JS so was looking for advice on whether this was a bad/good way to write the script? A previous version of my implementation was reviewed here. I was just thinking, would it have been more...
First string includes 4 integers: N, M, A, B (1 ≤ N, M ≤ 300, A, B ≤ 1000). Each next line include M-symbols. Symbol . is a clean cell, * and ** are dirty. I need to find the sum for cleaning if A its sum of ** cell, B is sum of *. What I can do better? #include <iostream> #include <string> #include <vector> using std...