ui code: === library(shiny) shinyUI( # Use a fluid Bootstrap layout fluidPage( # Generate a row with a sidebar sidebarLayout( # Define the sidebar with one input sidebarPanel( sliderInput("capacity", "Current Capacity:", min=0, max=100

I am making a game in HTML5, JS. In the game I perform the collisions by circle-shapes since my sprites are rotating. The player has different shapes since it has different sprites when it holds different weapons. The radius of the player is half the

Given an array of node and an array of edges, how do you calculate the number of connected graphs?You can use a union find (you can search it up). Start with all of the nodes as separate sets, then for each edge join the two nodes that the edge conne

Given a random variable with probability density function f(x), how to compute the expected value of this random variable in R?If you want to compute the expected value, just compute : E(X) = Integral of xf(x)dx over the whole domain of X. The integr

This question already has an answer here: Extract the maximum value within each group in a dataframe 3 answers i now have a data frame which the month and day are in different columns. How should i write the code to get exactly the last day of each m

I have a problem where i have to find missing numbers within an array and add them to a set. The question goes like so: Array of size (n-m) with numbers from 1..n with m of them missing. Find one all of the missing numbers in O(log). Array is sorted.

If I have a list in Python like [1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1] How do I calculate the greatest number of repeats for any element? In this case 2 is repeated a maximum of 4 times and 1 is repeated a maximum of 3 times. Is there a way to do this

I have a data frame in pandas where the index are business days. I want to create a new data frame using only the last day of each month, along with the corresponding data in the various columns. I have tried a few different ways with little success

This is a variant question from the Elements of Programming Interviews and doesn't come with a solution. How can you compute the smallest number of queens that can be placed to attack each uncovered square?The problem is about finding a minimal domin

I have an array list called children that has objects that move around certain whole value distances in the GUI and I need to find the smallest of these values and print it to the console. I'm pretty sure this calls for a for loop right? I just don't

I am reading time series data CSV into an R data frame, using the read.csv function I am then converting the date column (column 1) as follows: mydata[,1] <- as.Date(mydata[,1]) I want to know how to: Sort the data in the data frame by date (ascendin

For my code, my drop down lists are initiated on the original page, via <select name =country id=country onchange=showRecords(this.value,'country','province')>" This function is taking the value, equating it to country, then querying MySQL, and

I want to get the recent value. ID month_0 month_01 month_02 month_03 1 0 10 0 0 2 10 0 0 0 3 10 0 35 0 4 0 0 15 0 5 0 0 0 35 My data is as above, I want to get the recency value. recency id 1 -> 1 id 2 -> 0 id 3 -> 0 id 4 -> 2 id 5 -> 3 Pl

Thanks to this question I managed to work out how to constrain my generic method to accept only enums. Now I'm trying to create a generic method so that I can bind a drop-down to any enum I choose, displaying the description in the drop-down, with th