Converting a function with single parameter to a function with multiple parameters

I have been solving some algorithm questions recently and a pattern I have observed in some problems is as follows:

Given a string or a list, do an aggregation operation on each of its elements. Here in each of these elements we apply some recurrence to solve it.

An example of one such problem is below.

Problem: Given n integers return the total number of binary search trees that can be formed using the n integers

To solve this problem, I define a recurrence relation as follows:

f(n) = 1 // if n = 0 f(n) = ∑ f(i) * f(n-i-1) where 0 <= i <= n-1 

This works and I get the correct answer however I want to modify the function a bit.

Instead of expressing the function in terms of f(n) I want to express it in terms of f(n, i) so I can remove the summation. However I am unable to do it correctly.


My code to solve the problem by defining the recurrence in terms of f(n) is as follows: (I am aware it can be optimized by DP but that is not what I am trying to do here)

public int f(int n) {     if(n == 0)         return 1;      int result = 0;     for(int i = 0; i< n; i++)         result += f(i) * f(n-i-1);     return result; } 

I want to remove that for loop and instead express the function in terms of f(n,i) instead of f(n).


  1. How to convert the recurrence shown above from f(n) to f(n,i) and remove the summation?
    • Here ‘n’ is the size of the list of element and ‘i’ is the ith element in the list that we choose to be the root of the tree.

Applying the Parameter Theorem to show that a function is not computable

Show that $ g: \mathbb{N} \to \mathbb{N}$ such that $ $ g(x)=\begin{cases} 1 & \text{if halt}(2833,x) \ 0 & \text{otherwise} \end{cases}$ $ is not computable.

We know that

$ $ g(x)=\begin{cases} 1 & \text{if }\Phi_x(2833)\downarrow \ 0 & \text{if }\Phi_x(2833)\uparrow \end{cases}$ $

How can I use the parameter theorem to reduce $ g$ to $ \text{halt}(x,x)$ ? I’m very confused.

Is there any official documentation on the AdSense data-adtest=”on” parameter to test locally?

On many places over the internet you can find people suggesting the data-adtest="on" parameter to test ads on your local environment.

<ins className="adsbygoogle"   style={{display:"inline-block", width:"360px", height:"180px"}}   data-ad-client="XXXXX"   data-ad-slot="XXXXX"   data-adtest="on"         // <----------------------------- > </ins> 

I could make it work with trial and error. Some sites even suggest that the proper name is data-ad-test.

But is there an official documentation about this?

I there is, I still haven’t found.

Demonstrating reflected XSS with GET Parameter and URL encoding

A client is developing a website which is vulnerable to reflected XSS through a GET parameter:")||true)alert("XSS");</script> 

I would like to demonstrate this vulnerability by providing a link like the above but the text contains characters (such as the ") which are URL encoded by a browser, resulting in an invalid, unexecuted script.
I’ve also found that using a form within HTML to perform a GET request also results in URL encoding of the payload string.

I can however use the BurpSuite proxy to make the request without URL encoding, resulting in the script execution.

I would like to demonstrate script using only a browser available in the client environment. Any ideas on how this could be achieved?

Does replica config parameter affect primary/master RDS Postgres?

I want to add hot_standby_feedback = on to a RDS readonly replica.

The problem is that the replica currently has a parameter group already attached, which is inherited from the master. My question is: does adding hot_standby_feedback = on to the master parameter group affect the master instance negatively so that I’d better attach a new parameter group to the replica?

How to deindex an URL with specific parameter?

While I was doing an audit of my website SEO, I found a warning for a page that is most of the time blank.

Basically, this page serves for storing articles for visitors who would like to read their favorite selections later.

This is what the link looks like:

The problem with this is that the URL is the same as the homepage and as you can see it has next to it the parameter “read-it-later”.

So I want to be very careful on how to prevent this URL from being indexed by google without compromising the indexing of the homepage.

Do you have any suggestions on the best approach through .htaccess or WordPress?

How can HTTP Parameter Pollution be exploited?

In HTTP Parameter Pollution, I know theory how it work; you inject multiple HTTP parameters with the same name to trigger bugs in the server, but I can’t understand how one can exploit this.

When I send some request using this technique and for example I know that the server is using last occurrence of parameter, how this technique can be useful, because no matter what, server this uses last occurrence, so it doesn’t matter what were other occurrences right? Or when server does concatenate parameters with same name, some server script will get concatenated result.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘wpss_social_addtoany_js’

I have made an update of the plugins and themes and now it throws me this warning.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘wpss_social_addtoany_js’ not found or invalid function name in /home/html/wp-includes/class-wp-hook.php on line 286

IDX10630: The ‘[PII is hidden]’ for signing cannot be smaller than ‘[PII is hidden]’ bits. KeySize: ‘[PII is hidden]’. Parameter name: key.KeySize

I just created a SharePoint Add-in in Visual Studio for SharePoint 2016. When I run the add-in, which is nothing but anything that visual studio has generated, I am getting the following error:

IDX10630: The '[PII is hidden]' for signing cannot be smaller than '[PII is hidden]' bits. KeySize: '[PII is hidden]'. Parameter name: key.KeySize Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  Exception Details: System.ArgumentOutOfRangeException: IDX10630: The '[PII is hidden]' for signing cannot be smaller than '[PII is hidden]' bits. KeySize: '[PII is hidden]'. Parameter name: key.KeySize  Source Error:   Line 816:                ); Line 817:             Line 818:            string actorTokenString = new JwtSecurityTokenHandler().WriteToken(actorToken); Line 819: Line 820:            if (appOnly) 

I am using mvc. Any idea what could be wrong? Thank you.